{"id":17045300,"url":"https://github.com/phanect/nuxt-canonical-ogurl","last_synced_at":"2026-04-26T10:30:19.008Z","repository":{"id":41905940,"uuid":"463788986","full_name":"phanect/nuxt-canonical-ogurl","owner":"phanect","description":"[Deprecated] Automatically generate canonical and og:url meta tags for Nuxt applications","archived":true,"fork":false,"pushed_at":"2022-11-17T21:02:17.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-28T05:44:45.608Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phanect.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-26T07:47:07.000Z","updated_at":"2024-05-27T03:59:54.000Z","dependencies_parsed_at":"2023-01-21T09:38:11.022Z","dependency_job_id":null,"html_url":"https://github.com/phanect/nuxt-canonical-ogurl","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phanect%2Fnuxt-canonical-ogurl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phanect%2Fnuxt-canonical-ogurl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phanect%2Fnuxt-canonical-ogurl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phanect%2Fnuxt-canonical-ogurl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phanect","download_url":"https://codeload.github.com/phanect/nuxt-canonical-ogurl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240058604,"owners_count":19741485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T09:37:02.820Z","updated_at":"2026-04-26T10:30:18.943Z","avatar_url":"https://github.com/phanect.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nuxt-canonical-ogurl\n\nA Nuxt module to automatically generate canonical and og:url meta tags\n\n# Deprecation Notice\n\nThis module is deprecated because it only works with Nuxt 2.\nOn Nuxt 3, this module is not required to automatically add `canonical` and `og:url`.\n\nTo automatically add `canonical` and `og:url`, try following code in app.vue:\n\n```vue\n\u003ctemplate\u003e\n  \u003cdiv\u003e\n    \u003cNuxtLayout\u003e\n      \u003cNuxtPage/\u003e\n    \u003c/NuxtLayout\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript setup\u003e\nconst route = useRoute();\n\nconst canonical = `https://example.com${route.path.replace(/\\/$/, \"\")}`; // without trailing slash\nconst canonicalWithSlash = `https://example.com${route.path.replace(/\\/$/, \"\")}/`; // with trailing slash\n\nuseHead({\n  meta: [\n    { name: \"og:url\", content: canonical },\n  ],\n  link: [\n    { rel: \"canonical\", href: canonical },\n  ],\n});\n\u003c/script\u003e\n```\n\n# Set up\n\n1. Add `nuxt-canonical-ogurl` to the dependency in your project\n\n```shell\n$ npm install nuxt-canonical-ogurl\n```\n\nor\n\n```shell\n$ yarn add nuxt-canonical-ogurl\n```\n\n2. Add `nuxt-canonical-ogurl` to `buildModules` in nuxt.config.js, then configure options\n\n```javascript\nexport default {\n  // ...\n  buildModules: [\n    \"nuxt-canonical-ogurl\",\n  ],\n  canonicalOgUrl: {\n    baseURL: \"https://example.com\",\n  },\n  // You need to set router.trailingSlash true or false to use this module\n  router: {\n    trailingSlash: true,\n  },\n}\n```\n\nTo complete set up `nuxt-canonical-ogurl`, you need to set router.trailingSlash.\nIf you set `router.trailingSlash: true`, trailing slashes are added to the canonical URLs. (e.g. https://example.com/foo/)\nIf you set `router.trailingSlash: false`, trailing slashes are stripped from the canonical URLs. (e.g. https://example.com/foo)\nIf you don't set `router.trailingSlash`, `nuxt-canonical-ogurl` raises an error.\n\n# Options\n```javascript\nexport default {\n  // ...\n  canonicalOgUrl: {\n    baseURL: \"https://example.com\",\n  },\n}\n```\n\n## `baseURL`\ntype: `String`\n\nBase URL for canonical tags.\nIf you set `baseURL: \"https://example.com\"`, canonical URL for pages/foo.vue would be \"https://example.com/foo/\" (in case `router.trailingSlash: true`).\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphanect%2Fnuxt-canonical-ogurl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphanect%2Fnuxt-canonical-ogurl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphanect%2Fnuxt-canonical-ogurl/lists"}