From 632df5b51fd73b41727c54de5be3ce7e96b36902 Mon Sep 17 00:00:00 2001 From: harlan Date: Wed, 11 Sep 2024 15:08:17 +1000 Subject: [PATCH] progress commit --- .playground/nuxt.config.ts | 2 +- .playground/pages/blog/tag/[slug].vue | 9 + docs/components/HeaderLinks.vue | 118 - docs/components/docs/DocsAsideLinks.vue | 111 - docs/content/0.nuxt-seo/_dir.yml | 1 - .../1.getting-started/0.what-is-nuxt-seo.md | 0 .../1.getting-started/1.installation.md | 0 .../1.getting-started/2.faq.md | 0 .../1.getting-started/3.stackblitz.md | 0 .../1.getting-started/_dir.yml | 0 .../1.robots/1.getting-started/0.features.md | 46 - .../1.getting-started/0.installation.md | 34 - .../1.getting-started/3.stackblitz.md | 12 - .../1.robots/1.getting-started/_dir.yml | 1 - .../1.getting-started/how-it-works.md | 94 - .../content/1.robots/1.integrations/0.i18n.md | 75 - .../1.robots/1.integrations/1.content.md | 41 - docs/content/1.robots/1.integrations/_dir.yml | 1 - .../1.robots/2.guides/0.disable-indexing.md | 54 - .../2.guides/0.disable-page-indexing.md | 58 - .../content/1.robots/2.guides/1.robots-txt.md | 68 - docs/content/1.robots/2.guides/1.yandex.md | 48 - .../1.robots/2.guides/2.route-rules.md | 44 - .../1.robots/2.guides/3.nuxt-config.md | 65 - docs/content/1.robots/2.guides/_dir.yml | 1 - .../1.robots/3.api/0.use-robots-rule.md | 48 - docs/content/1.robots/3.api/1.config.md | 161 - docs/content/1.robots/3.api/1.nuxt-hooks.md | 21 - docs/content/1.robots/3.api/_dir.yml | 1 - .../3.nitro-api/0.get-path-robot-config.md | 16 - .../3.nitro-api/0.get-site-indexable.md | 19 - .../1.robots/3.nitro-api/2.nitro-hooks.md | 55 - docs/content/1.robots/3.nitro-api/_dir.yml | 1 - docs/content/1.robots/4.releases/0.v3.md | 130 - docs/content/1.robots/4.releases/1.v4.md | 176 - docs/content/1.robots/4.releases/_dir.yml | 1 - docs/content/1.robots/_dir.yml | 1 - .../0.getting-started/0.background.md | 70 - .../0.getting-started/0.installation.md | 49 - .../0.getting-started/3.how-it-works.md | 98 - .../10.site-config/0.getting-started/_dir.yml | 1 - .../10.site-config/1.integrations/0.i18n.md | 76 - .../10.site-config/1.integrations/_dir.yml | 1 - .../2.guides/0.setting-site-config.md | 55 - .../2.guides/3.runtime-site-config.md | 57 - docs/content/10.site-config/2.guides/_dir.yml | 1 - .../10.site-config/2.guides/debugging.md | 27 - .../10.site-config/4.api/0.site-link.md | 69 - .../10.site-config/4.api/0.use-site-config.md | 57 - .../4.api/1.update-site-config.md | 27 - .../4.api/4.create-site-path-resolver.md | 43 - .../4.api/5.use-nitro-origin.md | 20 - docs/content/10.site-config/4.api/_dir.yml | 1 - docs/content/10.site-config/4.api/config.md | 91 - .../10.site-config/4.api/nuxt-hooks.md | 21 - .../4.nitro-api/0.use-site-config.md | 17 - .../4.nitro-api/1.update-site-config.md | 24 - .../4.nitro-api/3.get-site-indexable.md | 20 - .../4.create-site-path-resolver.md | 21 - .../4.nitro-api/5.use-nitro-origin.md | 17 - .../10.site-config/4.nitro-api/_dir.yml | 1 - .../10.site-config/4.nitro-api/nitro-hooks.md | 31 - .../10.site-config/4.releases/_dir.yml | 1 - docs/content/10.site-config/_dir.yml | 1 - .../2.guides/0.using-the-modules.md | 0 .../2.guides/1.configuring-modules.md | 0 .../2.guides/2.default-meta.md | 0 .../2.guides/2.fallback-title.md | 0 .../2.guides/2.redirect-canonical.md | 0 .../2.guides/2.title-templates.md | 0 .../2.guides/3.trailing-slashes.md | 0 .../{0.nuxt-seo => }/2.guides/4.i18n.md | 0 .../{0.nuxt-seo => }/2.guides/_dir.yml | 0 .../2.seo-guides/1.going-live.md | 0 .../{0.nuxt-seo => }/2.seo-guides/_dir.yml | 0 .../0.getting-started/1.installation.md | 59 - .../0.getting-started/2.data-sources.md | 117 - .../0.getting-started/3.stackblitz.md | 15 - .../2.sitemap/0.getting-started/4.faq.md | 24 - .../2.sitemap/0.getting-started/_dir.yml | 1 - .../2.sitemap/1.integrations/0.i18n.md | 98 - .../2.sitemap/1.integrations/1.content.md | 93 - .../2.sitemap/1.integrations/2.robots.md | 13 - .../content/2.sitemap/1.integrations/_dir.yml | 1 - .../2.sitemap/2.guides/0.filtering-urls.md | 80 - docs/content/2.sitemap/2.guides/0.lastmod.md | 54 - .../2.sitemap/2.guides/1.multi-sitemaps.md | 206 - .../2.sitemap/2.guides/2.dynamic-urls.md | 135 - .../2.sitemap/2.guides/2.images-videos.md | 180 - docs/content/2.sitemap/2.guides/3.cache.md | 42 - .../2.sitemap/2.guides/4.route-rules.md | 34 - .../2.sitemap/2.guides/5.prerendering.md | 63 - .../2.sitemap/2.guides/6.customising-ui.md | 87 - .../content/2.sitemap/2.guides/7.debugging.md | 24 - .../2.sitemap/2.guides/8.best-practices.md | 74 - .../2.guides/9.submitting-sitemap.md | 33 - docs/content/2.sitemap/2.guides/_dir.yml | 1 - docs/content/2.sitemap/4.api/0.config.md | 223 - docs/content/2.sitemap/4.api/_dir.yml | 1 - docs/content/2.sitemap/4.api/schema.md | 94 - docs/content/2.sitemap/5.nitro-api/_dir.yml | 1 - .../2.sitemap/5.nitro-api/nitro-hooks.md | 90 - docs/content/2.sitemap/5.releases/_dir.yml | 1 - docs/content/2.sitemap/5.releases/v3.md | 148 - docs/content/2.sitemap/5.releases/v4.md | 126 - docs/content/2.sitemap/5.releases/v5.md | 57 - docs/content/2.sitemap/5.releases/v6.md | 60 - docs/content/2.sitemap/_dir.yml | 1 - .../{0.nuxt-seo => }/3.api/4.breadcrumbs.md | 0 .../{0.nuxt-seo => }/3.api/9.config.md | 0 .../3.api/_breadcrumb-nuxt-ui.md | 0 .../{0.nuxt-seo => }/3.api/_breadcrumb-raw.md | 0 docs/content/{0.nuxt-seo => }/3.api/_dir.yml | 0 .../0.getting-started/1.installation.md | 51 - .../0.getting-started/3.stackblitz.md | 23 - .../0.getting-started/4.examples.md | 26 - .../5.getting-familar-with-nuxt-og-image.md | 213 - .../3.og-image/0.getting-started/6.faq.md | 10 - .../3.og-image/0.getting-started/_dir.yml | 1 - .../3.og-image/1.integrations/1.content.md | 57 - .../3.og-image/1.integrations/2.color-mode.md | 25 - docs/content/3.og-image/3.guides/0.satori.md | 27 - .../content/3.og-image/3.guides/1.chromium.md | 67 - .../3.og-image/3.guides/1.compatibility.md | 144 - .../3.og-image/3.guides/2.route-rules.md | 25 - docs/content/3.og-image/3.guides/3.cache.md | 91 - docs/content/3.og-image/3.guides/3.jpegs.md | 47 - .../3.og-image/3.guides/5.custom-fonts.md | 99 - .../3.guides/5.non-english-locales.md | 31 - docs/content/3.og-image/3.guides/6.emojis.md | 48 - .../3.og-image/3.guides/6.icons-and-images.md | 52 - docs/content/3.og-image/3.guides/7.styling.md | 59 - docs/content/3.og-image/3.guides/_dir.yml | 1 - .../4.api/0.define-og-image-component.md | 40 - .../4.api/0.define-og-image-screenshot.md | 67 - .../3.og-image/4.api/0.define-og-image.md | 199 - .../3.og-image/4.api/2.nuxt-seo-template.md | 69 - docs/content/3.og-image/4.api/3.components.md | 30 - docs/content/3.og-image/4.api/3.config.md | 125 - docs/content/3.og-image/4.api/3.nuxt-hooks.md | 53 - docs/content/3.og-image/4.api/_dir.yml | 1 - .../3.og-image/5.nitro-api/4.nitro-hooks.md | 49 - docs/content/3.og-image/5.nitro-api/_dir.yml | 1 - .../3.og-image/6.migration-guide/_dir.yml | 1 - .../3.og-image/6.migration-guide/v3.md | 141 - docs/content/3.og-image/7.releases/_dir.yml | 1 - docs/content/3.og-image/7.releases/v2.md | 203 - docs/content/3.og-image/7.releases/v3.md | 381 -- docs/content/3.og-image/_dir.yml | 1 - .../{0.nuxt-seo => }/4.releases/_dir.yml | 0 .../0.getting-started/1.installation.md | 44 - .../0.getting-started/3.stackblitz.md | 12 - .../4.schema-org/0.getting-started/_dir.yml | 1 - .../0.getting-started/how-it-works.md | 29 - .../2.guides/0.default-schema-org.md | 44 - .../4.schema-org/2.guides/1.quick-setup.md | 45 - docs/content/4.schema-org/2.guides/2.nodes.md | 59 - .../2.guides/3.full-documentation.md | 21 - .../4.schema-org/2.guides/7.debugging.md | 27 - docs/content/4.schema-org/2.guides/_dir.yml | 1 - docs/content/4.schema-org/4.api/0.config.md | 76 - .../4.schema-org/4.api/1.nuxt-hooks.md | 26 - docs/content/4.schema-org/4.api/_dir.yml | 1 - docs/content/4.schema-org/4.releases/_dir.yml | 1 - docs/content/4.schema-org/4.releases/v2.md | 49 - docs/content/4.schema-org/4.releases/v3.md | 23 - docs/content/4.schema-org/_dir.yml | 1 - .../0.getting-started/1.installation.md | 18 - .../0.getting-started/3.stackblitz.md | 10 - .../6.link-checker/0.getting-started/_dir.yml | 1 - .../1.integrations/0.sitemap.md | 6 - .../6.link-checker/1.integrations/_dir.yml | 1 - .../2.guides/0.live-inspections.md | 38 - .../2.guides/1.exclude-links.md | 18 - .../2.guides/1.skip-inspections.md | 34 - .../6.link-checker/2.guides/2.build-scans.md | 58 - docs/content/6.link-checker/2.guides/_dir.yml | 1 - docs/content/6.link-checker/4.api/0.config.md | 94 - docs/content/6.link-checker/4.api/_dir.yml | 1 - .../6.link-checker/4.releases/_dir.yml | 1 - docs/content/6.link-checker/4.releases/v2.md | 49 - docs/content/6.link-checker/4.releases/v3.md | 69 - docs/content/6.link-checker/_dir.yml | 1 - .../6.migration-guide/0.nuxt-seo-kit.md | 0 .../6.migration-guide/1.beta-to-rc.md | 0 .../6.migration-guide/_dir.yml | 0 .../0.getting-started/0.features.md | 38 - .../0.getting-started/1.installation.md | 39 - .../7.experiments/0.getting-started/_dir.yml | 1 - .../7.experiments/2.guides/0.app-icons.md | 92 - .../2.guides/1.open-graph-images.md | 110 - .../2.guides/2.nuxt-config-seo-meta.md | 26 - .../7.experiments/2.guides/3.route-rules.md | 44 - docs/content/7.experiments/2.guides/_dir.yml | 1 - docs/content/7.experiments/3.api/0.config.md | 43 - docs/content/7.experiments/3.api/_dir.yml | 1 - .../content/7.experiments/4.releases/_dir.yml | 1 - docs/content/7.experiments/4.releases/v3.md | 138 - docs/content/7.experiments/4.releases/v4.md | 39 - docs/content/7.experiments/_dir.yml | 1 - docs/content/_dir.yml | 1 + docs/content/index.md | 5 - docs/pages/[...slug].vue | 230 - {docs => nuxtseo.com}/.nuxtrc | 0 {docs => nuxtseo.com}/app.config.ts | 0 {docs => nuxtseo.com}/app.vue | 24 +- {docs => nuxtseo.com}/app/router.options.ts | 0 .../components/BouncingBots.vue | 0 {docs => nuxtseo.com}/components/Discord.vue | 0 {docs => nuxtseo.com}/components/Header.vue | 8 +- nuxtseo.com/components/HeaderLinks.vue | 202 + {docs => nuxtseo.com}/components/Logo.vue | 0 .../components/MetricGuage.vue | 0 .../components/OgImage/Home.vue | 13 +- .../components/OgImage/Module.vue | 13 +- .../components/OgImage/NuxtSeo.vue | 13 +- .../components/OgImage/Release.vue | 13 +- .../components/ShowcaseCard.vue | 0 .../components/ShowcaseCardLink.vue | 0 nuxtseo.com/components/TableOfContents.vue | 58 + {docs => nuxtseo.com}/components/Tweet.vue | 0 {docs => nuxtseo.com}/components/ads/Ads.vue | 23 +- .../components/ads/AdsFallback.vue | 0 .../components/content/Image.vue | 0 .../components/content/SchemaOrgNodeList.vue | 3 +- .../components/content/TabComparison.vue | 0 .../examples/BreadcrumbNuxtUiExample.vue | 0 .../content/examples/BreadcrumbRawExample.vue | 0 .../components/docs/DocsAside.vue | 0 .../components/docs/DocsAsideLinks.vue | 110 + .../components/docs/DocsFooter.vue | 0 .../components/docs/DocsPageFooter.vue | 0 .../components/docs/DocsPageHeader.vue | 0 .../components/docs/DocsPrevNext.vue | 0 .../components/docs/DocsPrevNextCard.vue | 0 .../components/docs/DocsSearch.vue | 0 .../components/docs/DocsSearchButton.vue | 2 +- .../components/docs/DocsToc.vue | 0 .../components/docs/DocsTocLinks.vue | 0 .../components/global/LegoTweetMediaPhoto.vue | 0 {docs => nuxtseo.com}/composables/useDocs.ts | 0 .../composables/useScrollspy.ts | 0 {docs => nuxtseo.com}/css/scrollbars.css | 0 {docs => nuxtseo.com}/error.vue | 0 {docs => nuxtseo.com}/nuxt.config.ts | 23 +- {docs => nuxtseo.com}/package.json | 2 +- nuxtseo.com/pages/[...slug].vue | 140 + .../pages/index.vue | 47 +- {docs => nuxtseo.com}/pages/learn.vue | 0 {docs => nuxtseo.com}/public/favicon.ico | Bin {docs => nuxtseo.com}/public/grid.png | Bin {docs => nuxtseo.com}/public/icon.png | Bin .../public/nuxt-link-checker-live.png | Bin .../public/og-image-editing.png | Bin .../public/sitemap/formatting-error.png | Bin .../server/api/get-tweet/[tweetId].get.ts | 0 {docs => nuxtseo.com}/tailwind.config.ts | 0 {docs => nuxtseo.com}/tsconfig.json | 0 {docs => nuxtseo.com}/utils/data.ts | 22 +- package.json | 13 +- pnpm-lock.yaml | 4202 +++-------------- 261 files changed, 1345 insertions(+), 12361 deletions(-) create mode 100644 .playground/pages/blog/tag/[slug].vue delete mode 100644 docs/components/HeaderLinks.vue delete mode 100644 docs/components/docs/DocsAsideLinks.vue delete mode 100644 docs/content/0.nuxt-seo/_dir.yml rename docs/content/{0.nuxt-seo => }/1.getting-started/0.what-is-nuxt-seo.md (100%) rename docs/content/{0.nuxt-seo => }/1.getting-started/1.installation.md (100%) rename docs/content/{0.nuxt-seo => }/1.getting-started/2.faq.md (100%) rename docs/content/{0.nuxt-seo => }/1.getting-started/3.stackblitz.md (100%) rename docs/content/{0.nuxt-seo => }/1.getting-started/_dir.yml (100%) delete mode 100644 docs/content/1.robots/1.getting-started/0.features.md delete mode 100644 docs/content/1.robots/1.getting-started/0.installation.md delete mode 100644 docs/content/1.robots/1.getting-started/3.stackblitz.md delete mode 100644 docs/content/1.robots/1.getting-started/_dir.yml delete mode 100644 docs/content/1.robots/1.getting-started/how-it-works.md delete mode 100644 docs/content/1.robots/1.integrations/0.i18n.md delete mode 100644 docs/content/1.robots/1.integrations/1.content.md delete mode 100644 docs/content/1.robots/1.integrations/_dir.yml delete mode 100644 docs/content/1.robots/2.guides/0.disable-indexing.md delete mode 100644 docs/content/1.robots/2.guides/0.disable-page-indexing.md delete mode 100644 docs/content/1.robots/2.guides/1.robots-txt.md delete mode 100644 docs/content/1.robots/2.guides/1.yandex.md delete mode 100644 docs/content/1.robots/2.guides/2.route-rules.md delete mode 100644 docs/content/1.robots/2.guides/3.nuxt-config.md delete mode 100644 docs/content/1.robots/2.guides/_dir.yml delete mode 100644 docs/content/1.robots/3.api/0.use-robots-rule.md delete mode 100644 docs/content/1.robots/3.api/1.config.md delete mode 100644 docs/content/1.robots/3.api/1.nuxt-hooks.md delete mode 100644 docs/content/1.robots/3.api/_dir.yml delete mode 100644 docs/content/1.robots/3.nitro-api/0.get-path-robot-config.md delete mode 100644 docs/content/1.robots/3.nitro-api/0.get-site-indexable.md delete mode 100644 docs/content/1.robots/3.nitro-api/2.nitro-hooks.md delete mode 100644 docs/content/1.robots/3.nitro-api/_dir.yml delete mode 100644 docs/content/1.robots/4.releases/0.v3.md delete mode 100644 docs/content/1.robots/4.releases/1.v4.md delete mode 100644 docs/content/1.robots/4.releases/_dir.yml delete mode 100644 docs/content/1.robots/_dir.yml delete mode 100644 docs/content/10.site-config/0.getting-started/0.background.md delete mode 100644 docs/content/10.site-config/0.getting-started/0.installation.md delete mode 100644 docs/content/10.site-config/0.getting-started/3.how-it-works.md delete mode 100644 docs/content/10.site-config/0.getting-started/_dir.yml delete mode 100644 docs/content/10.site-config/1.integrations/0.i18n.md delete mode 100644 docs/content/10.site-config/1.integrations/_dir.yml delete mode 100644 docs/content/10.site-config/2.guides/0.setting-site-config.md delete mode 100644 docs/content/10.site-config/2.guides/3.runtime-site-config.md delete mode 100644 docs/content/10.site-config/2.guides/_dir.yml delete mode 100644 docs/content/10.site-config/2.guides/debugging.md delete mode 100644 docs/content/10.site-config/4.api/0.site-link.md delete mode 100644 docs/content/10.site-config/4.api/0.use-site-config.md delete mode 100644 docs/content/10.site-config/4.api/1.update-site-config.md delete mode 100644 docs/content/10.site-config/4.api/4.create-site-path-resolver.md delete mode 100644 docs/content/10.site-config/4.api/5.use-nitro-origin.md delete mode 100644 docs/content/10.site-config/4.api/_dir.yml delete mode 100644 docs/content/10.site-config/4.api/config.md delete mode 100644 docs/content/10.site-config/4.api/nuxt-hooks.md delete mode 100644 docs/content/10.site-config/4.nitro-api/0.use-site-config.md delete mode 100644 docs/content/10.site-config/4.nitro-api/1.update-site-config.md delete mode 100644 docs/content/10.site-config/4.nitro-api/3.get-site-indexable.md delete mode 100644 docs/content/10.site-config/4.nitro-api/4.create-site-path-resolver.md delete mode 100644 docs/content/10.site-config/4.nitro-api/5.use-nitro-origin.md delete mode 100644 docs/content/10.site-config/4.nitro-api/_dir.yml delete mode 100644 docs/content/10.site-config/4.nitro-api/nitro-hooks.md delete mode 100644 docs/content/10.site-config/4.releases/_dir.yml delete mode 100644 docs/content/10.site-config/_dir.yml rename docs/content/{0.nuxt-seo => }/2.guides/0.using-the-modules.md (100%) rename docs/content/{0.nuxt-seo => }/2.guides/1.configuring-modules.md (100%) rename docs/content/{0.nuxt-seo => }/2.guides/2.default-meta.md (100%) rename docs/content/{0.nuxt-seo => }/2.guides/2.fallback-title.md (100%) rename docs/content/{0.nuxt-seo => }/2.guides/2.redirect-canonical.md (100%) rename docs/content/{0.nuxt-seo => }/2.guides/2.title-templates.md (100%) rename docs/content/{0.nuxt-seo => }/2.guides/3.trailing-slashes.md (100%) rename docs/content/{0.nuxt-seo => }/2.guides/4.i18n.md (100%) rename docs/content/{0.nuxt-seo => }/2.guides/_dir.yml (100%) rename docs/content/{0.nuxt-seo => }/2.seo-guides/1.going-live.md (100%) rename docs/content/{0.nuxt-seo => }/2.seo-guides/_dir.yml (100%) delete mode 100644 docs/content/2.sitemap/0.getting-started/1.installation.md delete mode 100644 docs/content/2.sitemap/0.getting-started/2.data-sources.md delete mode 100644 docs/content/2.sitemap/0.getting-started/3.stackblitz.md delete mode 100644 docs/content/2.sitemap/0.getting-started/4.faq.md delete mode 100644 docs/content/2.sitemap/0.getting-started/_dir.yml delete mode 100644 docs/content/2.sitemap/1.integrations/0.i18n.md delete mode 100644 docs/content/2.sitemap/1.integrations/1.content.md delete mode 100644 docs/content/2.sitemap/1.integrations/2.robots.md delete mode 100644 docs/content/2.sitemap/1.integrations/_dir.yml delete mode 100644 docs/content/2.sitemap/2.guides/0.filtering-urls.md delete mode 100644 docs/content/2.sitemap/2.guides/0.lastmod.md delete mode 100644 docs/content/2.sitemap/2.guides/1.multi-sitemaps.md delete mode 100644 docs/content/2.sitemap/2.guides/2.dynamic-urls.md delete mode 100644 docs/content/2.sitemap/2.guides/2.images-videos.md delete mode 100644 docs/content/2.sitemap/2.guides/3.cache.md delete mode 100644 docs/content/2.sitemap/2.guides/4.route-rules.md delete mode 100644 docs/content/2.sitemap/2.guides/5.prerendering.md delete mode 100644 docs/content/2.sitemap/2.guides/6.customising-ui.md delete mode 100644 docs/content/2.sitemap/2.guides/7.debugging.md delete mode 100644 docs/content/2.sitemap/2.guides/8.best-practices.md delete mode 100644 docs/content/2.sitemap/2.guides/9.submitting-sitemap.md delete mode 100644 docs/content/2.sitemap/2.guides/_dir.yml delete mode 100644 docs/content/2.sitemap/4.api/0.config.md delete mode 100644 docs/content/2.sitemap/4.api/_dir.yml delete mode 100644 docs/content/2.sitemap/4.api/schema.md delete mode 100644 docs/content/2.sitemap/5.nitro-api/_dir.yml delete mode 100644 docs/content/2.sitemap/5.nitro-api/nitro-hooks.md delete mode 100644 docs/content/2.sitemap/5.releases/_dir.yml delete mode 100644 docs/content/2.sitemap/5.releases/v3.md delete mode 100644 docs/content/2.sitemap/5.releases/v4.md delete mode 100644 docs/content/2.sitemap/5.releases/v5.md delete mode 100644 docs/content/2.sitemap/5.releases/v6.md delete mode 100644 docs/content/2.sitemap/_dir.yml rename docs/content/{0.nuxt-seo => }/3.api/4.breadcrumbs.md (100%) rename docs/content/{0.nuxt-seo => }/3.api/9.config.md (100%) rename docs/content/{0.nuxt-seo => }/3.api/_breadcrumb-nuxt-ui.md (100%) rename docs/content/{0.nuxt-seo => }/3.api/_breadcrumb-raw.md (100%) rename docs/content/{0.nuxt-seo => }/3.api/_dir.yml (100%) delete mode 100644 docs/content/3.og-image/0.getting-started/1.installation.md delete mode 100644 docs/content/3.og-image/0.getting-started/3.stackblitz.md delete mode 100644 docs/content/3.og-image/0.getting-started/4.examples.md delete mode 100644 docs/content/3.og-image/0.getting-started/5.getting-familar-with-nuxt-og-image.md delete mode 100644 docs/content/3.og-image/0.getting-started/6.faq.md delete mode 100644 docs/content/3.og-image/0.getting-started/_dir.yml delete mode 100644 docs/content/3.og-image/1.integrations/1.content.md delete mode 100644 docs/content/3.og-image/1.integrations/2.color-mode.md delete mode 100644 docs/content/3.og-image/3.guides/0.satori.md delete mode 100644 docs/content/3.og-image/3.guides/1.chromium.md delete mode 100644 docs/content/3.og-image/3.guides/1.compatibility.md delete mode 100644 docs/content/3.og-image/3.guides/2.route-rules.md delete mode 100644 docs/content/3.og-image/3.guides/3.cache.md delete mode 100644 docs/content/3.og-image/3.guides/3.jpegs.md delete mode 100644 docs/content/3.og-image/3.guides/5.custom-fonts.md delete mode 100644 docs/content/3.og-image/3.guides/5.non-english-locales.md delete mode 100644 docs/content/3.og-image/3.guides/6.emojis.md delete mode 100644 docs/content/3.og-image/3.guides/6.icons-and-images.md delete mode 100644 docs/content/3.og-image/3.guides/7.styling.md delete mode 100644 docs/content/3.og-image/3.guides/_dir.yml delete mode 100644 docs/content/3.og-image/4.api/0.define-og-image-component.md delete mode 100644 docs/content/3.og-image/4.api/0.define-og-image-screenshot.md delete mode 100644 docs/content/3.og-image/4.api/0.define-og-image.md delete mode 100644 docs/content/3.og-image/4.api/2.nuxt-seo-template.md delete mode 100644 docs/content/3.og-image/4.api/3.components.md delete mode 100644 docs/content/3.og-image/4.api/3.config.md delete mode 100644 docs/content/3.og-image/4.api/3.nuxt-hooks.md delete mode 100644 docs/content/3.og-image/4.api/_dir.yml delete mode 100644 docs/content/3.og-image/5.nitro-api/4.nitro-hooks.md delete mode 100644 docs/content/3.og-image/5.nitro-api/_dir.yml delete mode 100644 docs/content/3.og-image/6.migration-guide/_dir.yml delete mode 100644 docs/content/3.og-image/6.migration-guide/v3.md delete mode 100644 docs/content/3.og-image/7.releases/_dir.yml delete mode 100644 docs/content/3.og-image/7.releases/v2.md delete mode 100644 docs/content/3.og-image/7.releases/v3.md delete mode 100644 docs/content/3.og-image/_dir.yml rename docs/content/{0.nuxt-seo => }/4.releases/_dir.yml (100%) delete mode 100644 docs/content/4.schema-org/0.getting-started/1.installation.md delete mode 100644 docs/content/4.schema-org/0.getting-started/3.stackblitz.md delete mode 100644 docs/content/4.schema-org/0.getting-started/_dir.yml delete mode 100644 docs/content/4.schema-org/0.getting-started/how-it-works.md delete mode 100644 docs/content/4.schema-org/2.guides/0.default-schema-org.md delete mode 100644 docs/content/4.schema-org/2.guides/1.quick-setup.md delete mode 100644 docs/content/4.schema-org/2.guides/2.nodes.md delete mode 100644 docs/content/4.schema-org/2.guides/3.full-documentation.md delete mode 100644 docs/content/4.schema-org/2.guides/7.debugging.md delete mode 100644 docs/content/4.schema-org/2.guides/_dir.yml delete mode 100644 docs/content/4.schema-org/4.api/0.config.md delete mode 100644 docs/content/4.schema-org/4.api/1.nuxt-hooks.md delete mode 100644 docs/content/4.schema-org/4.api/_dir.yml delete mode 100644 docs/content/4.schema-org/4.releases/_dir.yml delete mode 100644 docs/content/4.schema-org/4.releases/v2.md delete mode 100644 docs/content/4.schema-org/4.releases/v3.md delete mode 100644 docs/content/4.schema-org/_dir.yml delete mode 100644 docs/content/6.link-checker/0.getting-started/1.installation.md delete mode 100644 docs/content/6.link-checker/0.getting-started/3.stackblitz.md delete mode 100644 docs/content/6.link-checker/0.getting-started/_dir.yml delete mode 100644 docs/content/6.link-checker/1.integrations/0.sitemap.md delete mode 100644 docs/content/6.link-checker/1.integrations/_dir.yml delete mode 100644 docs/content/6.link-checker/2.guides/0.live-inspections.md delete mode 100644 docs/content/6.link-checker/2.guides/1.exclude-links.md delete mode 100644 docs/content/6.link-checker/2.guides/1.skip-inspections.md delete mode 100644 docs/content/6.link-checker/2.guides/2.build-scans.md delete mode 100644 docs/content/6.link-checker/2.guides/_dir.yml delete mode 100644 docs/content/6.link-checker/4.api/0.config.md delete mode 100644 docs/content/6.link-checker/4.api/_dir.yml delete mode 100644 docs/content/6.link-checker/4.releases/_dir.yml delete mode 100644 docs/content/6.link-checker/4.releases/v2.md delete mode 100644 docs/content/6.link-checker/4.releases/v3.md delete mode 100644 docs/content/6.link-checker/_dir.yml rename docs/content/{0.nuxt-seo => }/6.migration-guide/0.nuxt-seo-kit.md (100%) rename docs/content/{0.nuxt-seo => }/6.migration-guide/1.beta-to-rc.md (100%) rename docs/content/{0.nuxt-seo => }/6.migration-guide/_dir.yml (100%) delete mode 100644 docs/content/7.experiments/0.getting-started/0.features.md delete mode 100644 docs/content/7.experiments/0.getting-started/1.installation.md delete mode 100644 docs/content/7.experiments/0.getting-started/_dir.yml delete mode 100644 docs/content/7.experiments/2.guides/0.app-icons.md delete mode 100644 docs/content/7.experiments/2.guides/1.open-graph-images.md delete mode 100644 docs/content/7.experiments/2.guides/2.nuxt-config-seo-meta.md delete mode 100644 docs/content/7.experiments/2.guides/3.route-rules.md delete mode 100644 docs/content/7.experiments/2.guides/_dir.yml delete mode 100644 docs/content/7.experiments/3.api/0.config.md delete mode 100644 docs/content/7.experiments/3.api/_dir.yml delete mode 100644 docs/content/7.experiments/4.releases/_dir.yml delete mode 100644 docs/content/7.experiments/4.releases/v3.md delete mode 100644 docs/content/7.experiments/4.releases/v4.md delete mode 100644 docs/content/7.experiments/_dir.yml create mode 100644 docs/content/_dir.yml delete mode 100644 docs/content/index.md delete mode 100644 docs/pages/[...slug].vue rename {docs => nuxtseo.com}/.nuxtrc (100%) rename {docs => nuxtseo.com}/app.config.ts (100%) rename {docs => nuxtseo.com}/app.vue (78%) rename {docs => nuxtseo.com}/app/router.options.ts (100%) rename {docs => nuxtseo.com}/components/BouncingBots.vue (100%) rename {docs => nuxtseo.com}/components/Discord.vue (100%) rename {docs => nuxtseo.com}/components/Header.vue (81%) create mode 100644 nuxtseo.com/components/HeaderLinks.vue rename {docs => nuxtseo.com}/components/Logo.vue (100%) rename {docs => nuxtseo.com}/components/MetricGuage.vue (100%) rename {docs => nuxtseo.com}/components/OgImage/Home.vue (95%) rename {docs => nuxtseo.com}/components/OgImage/Module.vue (96%) rename {docs => nuxtseo.com}/components/OgImage/NuxtSeo.vue (95%) rename {docs => nuxtseo.com}/components/OgImage/Release.vue (95%) rename {docs => nuxtseo.com}/components/ShowcaseCard.vue (100%) rename {docs => nuxtseo.com}/components/ShowcaseCardLink.vue (100%) create mode 100644 nuxtseo.com/components/TableOfContents.vue rename {docs => nuxtseo.com}/components/Tweet.vue (100%) rename {docs => nuxtseo.com}/components/ads/Ads.vue (77%) rename {docs => nuxtseo.com}/components/ads/AdsFallback.vue (100%) rename {docs => nuxtseo.com}/components/content/Image.vue (100%) rename {docs => nuxtseo.com}/components/content/SchemaOrgNodeList.vue (90%) rename {docs => nuxtseo.com}/components/content/TabComparison.vue (100%) rename {docs => nuxtseo.com}/components/content/examples/BreadcrumbNuxtUiExample.vue (100%) rename {docs => nuxtseo.com}/components/content/examples/BreadcrumbRawExample.vue (100%) rename {docs => nuxtseo.com}/components/docs/DocsAside.vue (100%) create mode 100644 nuxtseo.com/components/docs/DocsAsideLinks.vue rename {docs => nuxtseo.com}/components/docs/DocsFooter.vue (100%) rename {docs => nuxtseo.com}/components/docs/DocsPageFooter.vue (100%) rename {docs => nuxtseo.com}/components/docs/DocsPageHeader.vue (100%) rename {docs => nuxtseo.com}/components/docs/DocsPrevNext.vue (100%) rename {docs => nuxtseo.com}/components/docs/DocsPrevNextCard.vue (100%) rename {docs => nuxtseo.com}/components/docs/DocsSearch.vue (100%) rename {docs => nuxtseo.com}/components/docs/DocsSearchButton.vue (66%) rename {docs => nuxtseo.com}/components/docs/DocsToc.vue (100%) rename {docs => nuxtseo.com}/components/docs/DocsTocLinks.vue (100%) rename {docs => nuxtseo.com}/components/global/LegoTweetMediaPhoto.vue (100%) rename {docs => nuxtseo.com}/composables/useDocs.ts (100%) rename {docs => nuxtseo.com}/composables/useScrollspy.ts (100%) rename {docs => nuxtseo.com}/css/scrollbars.css (100%) rename {docs => nuxtseo.com}/error.vue (100%) rename {docs => nuxtseo.com}/nuxt.config.ts (90%) rename {docs => nuxtseo.com}/package.json (96%) create mode 100644 nuxtseo.com/pages/[...slug].vue rename docs/components/HomePage.vue => nuxtseo.com/pages/index.vue (92%) rename {docs => nuxtseo.com}/pages/learn.vue (100%) rename {docs => nuxtseo.com}/public/favicon.ico (100%) rename {docs => nuxtseo.com}/public/grid.png (100%) rename {docs => nuxtseo.com}/public/icon.png (100%) rename {docs => nuxtseo.com}/public/nuxt-link-checker-live.png (100%) rename {docs => nuxtseo.com}/public/og-image-editing.png (100%) rename {docs => nuxtseo.com}/public/sitemap/formatting-error.png (100%) rename {docs => nuxtseo.com}/server/api/get-tweet/[tweetId].get.ts (100%) rename {docs => nuxtseo.com}/tailwind.config.ts (100%) rename {docs => nuxtseo.com}/tsconfig.json (100%) rename {docs => nuxtseo.com}/utils/data.ts (94%) diff --git a/.playground/nuxt.config.ts b/.playground/nuxt.config.ts index 314920e0..282b5e90 100644 --- a/.playground/nuxt.config.ts +++ b/.playground/nuxt.config.ts @@ -5,7 +5,6 @@ export default defineNuxtConfig({ modules: [ NuxtSeoKit, '@nuxt/ui', - 'nuxt-icon', ], devtools: { @@ -43,6 +42,7 @@ export default defineNuxtConfig({ routeRules: { '/about': { sitemap: { changefreq: 'daily', priority: 0.3 } }, '/secret': { index: false }, + '/blog/tag': { redirect: { to: '/blog/tags', statusCode: 301 } }, }, compatibilityDate: '2024-07-11', diff --git a/.playground/pages/blog/tag/[slug].vue b/.playground/pages/blog/tag/[slug].vue new file mode 100644 index 00000000..c2ffcc56 --- /dev/null +++ b/.playground/pages/blog/tag/[slug].vue @@ -0,0 +1,9 @@ + + + diff --git a/docs/components/HeaderLinks.vue b/docs/components/HeaderLinks.vue deleted file mode 100644 index ad195992..00000000 --- a/docs/components/HeaderLinks.vue +++ /dev/null @@ -1,118 +0,0 @@ - - - diff --git a/docs/components/docs/DocsAsideLinks.vue b/docs/components/docs/DocsAsideLinks.vue deleted file mode 100644 index 77763278..00000000 --- a/docs/components/docs/DocsAsideLinks.vue +++ /dev/null @@ -1,111 +0,0 @@ - - - diff --git a/docs/content/0.nuxt-seo/_dir.yml b/docs/content/0.nuxt-seo/_dir.yml deleted file mode 100644 index b0c46748..00000000 --- a/docs/content/0.nuxt-seo/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Robots diff --git a/docs/content/0.nuxt-seo/1.getting-started/0.what-is-nuxt-seo.md b/docs/content/1.getting-started/0.what-is-nuxt-seo.md similarity index 100% rename from docs/content/0.nuxt-seo/1.getting-started/0.what-is-nuxt-seo.md rename to docs/content/1.getting-started/0.what-is-nuxt-seo.md diff --git a/docs/content/0.nuxt-seo/1.getting-started/1.installation.md b/docs/content/1.getting-started/1.installation.md similarity index 100% rename from docs/content/0.nuxt-seo/1.getting-started/1.installation.md rename to docs/content/1.getting-started/1.installation.md diff --git a/docs/content/0.nuxt-seo/1.getting-started/2.faq.md b/docs/content/1.getting-started/2.faq.md similarity index 100% rename from docs/content/0.nuxt-seo/1.getting-started/2.faq.md rename to docs/content/1.getting-started/2.faq.md diff --git a/docs/content/0.nuxt-seo/1.getting-started/3.stackblitz.md b/docs/content/1.getting-started/3.stackblitz.md similarity index 100% rename from docs/content/0.nuxt-seo/1.getting-started/3.stackblitz.md rename to docs/content/1.getting-started/3.stackblitz.md diff --git a/docs/content/0.nuxt-seo/1.getting-started/_dir.yml b/docs/content/1.getting-started/_dir.yml similarity index 100% rename from docs/content/0.nuxt-seo/1.getting-started/_dir.yml rename to docs/content/1.getting-started/_dir.yml diff --git a/docs/content/1.robots/1.getting-started/0.features.md b/docs/content/1.robots/1.getting-started/0.features.md deleted file mode 100644 index 1b20d779..00000000 --- a/docs/content/1.robots/1.getting-started/0.features.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: 'Nuxt Robots Features' -description: 'Nuxt Robots manages the robots crawling your site with minimal config and best practice defaults.' -navigation: - title: 'Features' ---- - -Nuxt Robots manages the robots crawling your site with minimal config and best practice defaults. - -## 🤖 Robots.txt Config - -Configuring the rules is as simple as adding a production robots.txt file to your project. - -- [Config using Robots.txt](/robots/guides/robots-txt) - -## 🗿 X-Robots-Tag Header, Meta Tag - -Ensures pages that should not be indexed are not indexed with the following: -- `X-Robots-Tag` header -- `` meta tag - -Both enabled by default. - -- [How it works](/robots/getting-started/how-it-works) - -## 🔒 Production only indexing - -The module uses [Nuxt Site Config](/site-config/getting-started/background) to determine if the site is in production mode. - -It will disables non-production environments from being indexed, avoiding duplicate content issues. - -- [Environment Config](/robots/guides/disable-indexing) - -## 🔄 Easy and powerful configuration - -Use route rules to easily target subsets of your site. -When you need even more control, use the runtime Nitro hooks to dynamically configure your robots rules. - -- [Route Rules](/robots/guides/route-rules) -- [Nitro Hooks](/robots/nitro-api/nitro-hooks) - -## 🌎 I18n Support - -Will automatically fix any non-localised paths within your `allow` and `disallow` rules. - -- [I18n Integration](/robots/integrations/i18n) diff --git a/docs/content/1.robots/1.getting-started/0.installation.md b/docs/content/1.robots/1.getting-started/0.installation.md deleted file mode 100644 index 2fc5043d..00000000 --- a/docs/content/1.robots/1.getting-started/0.installation.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: 'Install Nuxt Robots' -description: 'Get started with Nuxt Robots by installing the dependency to your project.' -navigation: - title: 'Installation' ---- - -Using [Nuxt SEO](/nuxt-seo/getting-started/installation)? This module is already installed for you. - -## Setup - -1. Install `nuxt-robots` dependency to your project: - -```bash -npx nuxi@latest module add robots -``` - -## Staging / Testing Environments - -:UBadge{color="amber" variant="solid" label="Important"} - -If you're using Preview / Staging / Testing environments you will need to implement extra configuration. -This is important to avoid duplicate content issues and these environments appearing in Google searches. - -Please read the [Disabling Indexing](/robots/guides/disable-indexing) guide for more information. - -If you only have a production environment, you can skip this step. - -## Next Steps - -The module is now installed and configured! - -- Learn more about [how the module works](/robots/getting-started/how-it-works). -- Configure the module [using a robots.txt](/robots/guides/robots-txt). diff --git a/docs/content/1.robots/1.getting-started/3.stackblitz.md b/docs/content/1.robots/1.getting-started/3.stackblitz.md deleted file mode 100644 index 29ebfe9c..00000000 --- a/docs/content/1.robots/1.getting-started/3.stackblitz.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: "Reproductions: Stackblitz" -description: Create minimal reproductions for Nuxt Robots or just experiment with the module. ---- - -You can use the Nuxt Robots Stackblitz playgrounds for either: -- Playing around with the module in a sandbox environment -- Making reproductions for issues (Learn more about [Why Reproductions are Required](https://antfu.me/posts/why-reproductions-are-required)) - -## Stackblitz Playgrounds - -- [Basic](https://stackblitz.com/edit/nuxt-starter-zycxux?file=public%2F_robots.txt) diff --git a/docs/content/1.robots/1.getting-started/_dir.yml b/docs/content/1.robots/1.getting-started/_dir.yml deleted file mode 100644 index bcd2ba14..00000000 --- a/docs/content/1.robots/1.getting-started/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Getting Started diff --git a/docs/content/1.robots/1.getting-started/how-it-works.md b/docs/content/1.robots/1.getting-started/how-it-works.md deleted file mode 100644 index b9bdca47..00000000 --- a/docs/content/1.robots/1.getting-started/how-it-works.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -title: How It Works -description: Learn more about how Nuxt Robots works. ---- - -Nuxt Robots tells robots (crawlers) how to behave by creating a `robots.txt` file for you, adding a `X-Robots-Tag` header and `` tag to your site -where appropriate. - -One important behaviour to control is blocking Google from indexing pages to: -- Prevent [duplicate content issues](https://moz.com/learn/seo/duplicate-content) -- Prevent wasting [crawl budget](https://developers.google.com/search/docs/crawling-indexing/large-site-managing-crawl-budget) - -## Robots.txt - -For robots to understand how they can access your site, they will first check for a `robots.txt` file. - -```bash -public - └── robots.txt -``` - -This file is generated differently depending on the environment: -- When deploying using `nuxi generate` or the `nitro.prerender.routes` rule, this is a static file. -- Otherwise, it's handled by the server and generated at runtime when requested. - -When indexing is disabled a `robots.txt` will be generated with the following content: - -``` -User-agent: * -Disallow: / -``` - -This blocks all bots from indexing your site. - -## `X-Robots-Tag` Header and `` - -In some situations, the robots.txt becomes too restrictive to provide the level of control you need to manage -your site's indexing. - -For this reason, the module by default will provide a `X-Robots-Tag` header and `` tag. - -These are applied using the following logic: -- `X-Robots-Tag` header - Route Rules are implemented for all modes, otherwise SSR only. This will only be added -when indexing has been disabled for the route. -- `` - SSR only, will always be added - -## Robot Rules - -Default values for the `robots` rule depending on the mode. - -For indexable routes the following is used: - -```html - -``` - -Besides giving robots the go-ahead, this also requests that Google: - -
Choose the snippet length that it believes is most effective to help users discover your content and direct users to your site."
- -You can learn more on the [Robots Meta Tag](https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag) documentation, feel free -to change this to suit your needs using `robotsEnabledValue`. - -For non-indexable routes the following is used: - -```html - -``` - -This will tell robots to not index the page. - -## Development Environment - -The module by default will disable indexing in development environments. This is for safety, as you don't want -your development environment to be indexed by search engines. - -``` -# Block all bots -User-agent: * -Disallow: / -``` - -## Production Environments - -For production environments, the module will generate a `robots.txt` file that allows all bots. - -Out-of-the-box, this will be the following: - -``` -User-agent: * -Disallow: -``` - -This tells all bots that they can index your entire site. diff --git a/docs/content/1.robots/1.integrations/0.i18n.md b/docs/content/1.robots/1.integrations/0.i18n.md deleted file mode 100644 index 902e5c56..00000000 --- a/docs/content/1.robots/1.integrations/0.i18n.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: Nuxt I18n -description: How to use the Nuxt Robots module with Nuxt I18n. ---- - -Out of the box, the robots module will integrate directly with [@nuxtjs/i18n](https://i18n.nuxtjs.org/). -You will need to use v8+ of the i18n module. - -## Auto-localised Allow / Disallow - -The module will automatically localise the `allow` and `disallow` paths based on your i18n configuration. - -If you provide a `allow` or `disallow` path that is not localised, it will be localised for you, if your -i18n configuration allows it. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - robots: { - disallow: ['/secret', '/admin'], - }, - i18n: { - locales: ['en', 'fr'], - defaultLocale: 'en', - strategy: 'prefix', - } -}) -``` - -This will generate the following output: - -``` -User-agent: * -Disallow: /en/secret -Disallow: /en/admin -Disallow: /fr/secret -Disallow: /fr/admin -``` - -## Opting-out of localisation - -If you want to opt-out of localisation, there are two options: - -### Opt-out for a group - -You can provide the `_skipI18n` option to a group to disable localisation just for that group. - -```ts -export default defineNuxtConfig({ - robots: { - groups: [ - { - disallow: [ - '/docs/en/v*', - '/docs/zh/v*', - '/forum/admin/', - '/forum/auth/', - ], - _skipI18n: true, - }, - ], - }, -}) -``` - -### Opt-out i18n globally - -By providing the `autoI18n: false` option you will disable all i18n localisation splitting. - -```ts -export default defineNuxtConfig({ - robots: { - autoI18n: false, - } -}) -``` diff --git a/docs/content/1.robots/1.integrations/1.content.md b/docs/content/1.robots/1.integrations/1.content.md deleted file mode 100644 index 5d9865fc..00000000 --- a/docs/content/1.robots/1.integrations/1.content.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: Nuxt Content -description: How to use the Nuxt Robots module with Nuxt Content. ---- - -Nuxt Robots integrates with Nuxt Content out of the box. Allowing you to configure if -a page should be indexable or not right from your markdown files. - -## Setup - -Simply use the `robots: false` frontmatter key to opt out of indexing a page. - -```md [content/foo.md] ---- -robots: false ---- -``` - -This will require that your markdown files have an associated path. When using [Document Driven Mode](https://content.nuxt.com/document-driven/introduction), all markdown files will automatically -have a path set. - -Otherwise, you will need to make sure your markdown files have a `path` key. - -```md [content/foo.md] ---- -path: /foo -robots: false ---- -``` - -## How it works - -This will add an entry to your `robots.txt` file that looks like this: - -``` -User-agent: * -Disallow: /foo -``` - -It will add the `X-Robots-Tag` header and `` tag to the page with the value of -[`robotsDisabledValue`](/robots/api/config#robotsdisabledvalue). diff --git a/docs/content/1.robots/1.integrations/_dir.yml b/docs/content/1.robots/1.integrations/_dir.yml deleted file mode 100644 index 67b3de90..00000000 --- a/docs/content/1.robots/1.integrations/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Integrations diff --git a/docs/content/1.robots/2.guides/0.disable-indexing.md b/docs/content/1.robots/2.guides/0.disable-indexing.md deleted file mode 100644 index 0956c7bb..00000000 --- a/docs/content/1.robots/2.guides/0.disable-indexing.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: Disabling Site Indexing -description: Learn how to disable indexing for different environments and conditions to avoid crawling issues. ---- - -There are a number of reasons why you may want to disable indexing of your site. - -I've outlined some of the most common scenarios below. - -If you're trying to disable specific routes from being indexed, refer to the [Disabling Page Indexing](0.disable-page-indexing.md) guide. - -## Hidden Production - -In the case that you have a production site that you don't want search engines to know about, you should explicitly set the `indexable` option to `false`. - -This would be common for internal business tools, or sites that are not ready for public consumption. - -```ts -export default defineNuxtConfig({ - site: { indexable: false } -}) -``` - -## Preview / Staging / Testing Environments - -These environments are great for testing out code before it goes to production. But we definitely don't want search engines to index them. - -You want these hidden from search engines. You will need to provide a site `env` for each of them. - -This is only needed for non-production environments, as the default value is `production` when your Nuxt app is built. - -Because these will change depending on your environment, you should use the `NUXT_SITE_ENV` environment variable to set them. - -``` -NUXT_SITE_ENV=preview -``` - -Feel free to set it to whatever you want, as long as it's not `production`. - -## Alternative Production URLs - -In the case where you have multiple domains or subdomains which point to your canonical URL, you only want one version of them to be indexed. - -For example, `www.example.com` and `example.com`, we only want to index `example.com` - -In this case, you should _permanently redirect_ instead of opt-ing out of indexing. - -If you're using the [Nuxt SEO Module](/nuxt-seo/getting-started/what-is-nuxt-seo) you can use the `redirectToCanonicalSiteUrl` option. - -## Multi-tenancy Production Site - -This is a bit more complicated but this is where [Nuxt Site Config](/site-config/getting-started/installation) shines. - -See the [Runtime Site Config](/site-config/guides/runtime-site-config) guide to learn how to set site config at runtime. diff --git a/docs/content/1.robots/2.guides/0.disable-page-indexing.md b/docs/content/1.robots/2.guides/0.disable-page-indexing.md deleted file mode 100644 index 4bcbad11..00000000 --- a/docs/content/1.robots/2.guides/0.disable-page-indexing.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: Disabling Page Indexing -description: Learn how to disable indexing for specific pages on your app. ---- - -When disabling indexing for specific pages, you have a few options. - -## useRobotsRule - -The [useRobotsRule](/robots/api/use-robots-rule) composable provides a reactive way to access and set the robots rule at runtime. - -```ts -import { useRobotsRule } from '#imports' - -const rule = useRobotsRule() -rule.value = 'noindex, nofollow' -``` - -## Route Rules - -If you have a static page that you want to disable indexing for, you can use [defineRouteRules](https://nuxt.com/docs/api/utils/define-route-rules) (requires enabling the experimental `inlineRouteRules`). - -This is a build-time configuration that will generate the appropriate rules in the `/robots.txt` file and is integrated with the [Sitemap](/sitemap/integrations/robots) module. - -```vue [pages/about.vue] - -``` - -For more complex scenarios see the [Route Rules](/robots/guides/route-rules) guide. - -## Robots.txt - -To configure blocked URLs using a [robots.txt](/robots/guides/robots-txt) file, simply use the `Disallow` directive. - -``` -// public/_robots.txt -User-agent: * -Disallow: /my-page -Disallow: /secret/* -``` - -## Nuxt Config - -If you need finer programmatic control, you can configure the module using nuxt.config. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - robots: { - disallow: ['/secret', '/admin'], - } -}) -``` - -See the [Nuxt Config](/robots/guides/nuxt-config) guide for more details. diff --git a/docs/content/1.robots/2.guides/1.robots-txt.md b/docs/content/1.robots/2.guides/1.robots-txt.md deleted file mode 100644 index f20bd368..00000000 --- a/docs/content/1.robots/2.guides/1.robots-txt.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: Config using Robots.txt -description: Configure your generated robots.txt file with a robots.txt file. ---- - -The [robots.txt standard](https://developers.google.com/search/docs/crawling-indexing/robots/create-robots-txt) is important for search engines -to understand which pages to crawl and index. - -To match closer to the standard, Nuxt Robots recommends configuring the module by using a `robots.txt`. - -This file will be parsed, validated and used to configure the module. - -If you need programmatic control, you can configure the module using [nuxt.config.ts](/robots/guides/nuxt-config), -[Route Rules](/robots/guides/route-rules) and [Nitro hooks](/robots/nitro-api/nitro-hooks). - -## Creating a `robots.txt` file - -You can place your file in any location; the easiest is to use: `/public/_robots.txt`. - -Additionally, the following paths are supported by default: - -```bash [Example File Structure] -# root directory -robots.txt -# asset folders -assets/ -├── robots.txt -# pages folder -pages/ -├── robots.txt -├── _dir/ -│ └── robots.txt -# public folder -public/ -├── _robots.txt -├── _dir/ -│ └── robots.txt -``` - -### Custom paths - -If you find this too restrictive, -you can use the `mergeWithRobotsTxtPath` config to load your `robots.txt` file from any path. - -```ts -export default defineNuxtConfig({ - robots: { - mergeWithRobotsTxtPath: 'assets/custom/robots.txt' - } -}) -``` - -## Parsed robots.txt - -The following rules are parsed from your `robots.txt` file: - -- `User-agent` - The user-agent to apply the rules to. -- `Disallow` - An array of paths to disallow for the user-agent. -- `Allow` - An array of paths to allow for the user-agent. -- `Sitemap` - An array of sitemap URLs to include in the generated sitemap. - -This parsed data will be shown for environments that are `indexable`. - -## Conflicting `public/robots.txt` - -To ensure other modules can integrate with your generated robots file, you must not have a `robots.txt` file in your `public` folder. - -If you do, it will be moved to `/public/_robots.txt` and merged with the generated file. diff --git a/docs/content/1.robots/2.guides/1.yandex.md b/docs/content/1.robots/2.guides/1.yandex.md deleted file mode 100644 index d38ee8b9..00000000 --- a/docs/content/1.robots/2.guides/1.yandex.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: "Yandex: Clean-param" -description: "Learn how to use the `clean-param` directive to remove query parameters from URLs with Yandex." ---- - -Nuxt Robots is built around first-party robots.txt specifications from Google and Bing. - -Some users may want to configure Yandex, a popular search engine in Russia, and find that rules aren't working. To use -Yandex you will need to provide alternative directives. - -## Clean-param - -The `clean-param` directive is used to remove query parameters from URLs. This is useful for SEO as it prevents duplicate -content and consolidates page rank. - -It can either be configured directly through robots.txt when targeting Yandex or through the module configuration. - -### Robots.txt - -To configure the `clean-param` directive in your `robots.txt` file, you can use the following syntax: - -```txt -User-agent: Yandex -Clean-param: param1 param2 -``` - -This will remove the `param1` and `param2` query parameters from URLs. - -### Module Configuration - -To configure the `clean-param` directive in your `nuxt.config.ts` file, you can use the following syntax: - -```ts -export default defineNuxtConfig({ - robots: { - groups: [ - { - userAgent: ['Yandex'], - cleanParam: ['param1', 'param2'] - } - ] - } -}) -``` - -## Host & Crawl-delay - -These directives are deprecated and should not be used. All search engines will ignore them. diff --git a/docs/content/1.robots/2.guides/2.route-rules.md b/docs/content/1.robots/2.guides/2.route-rules.md deleted file mode 100644 index 6a335271..00000000 --- a/docs/content/1.robots/2.guides/2.route-rules.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: Config Using Route Rules -description: Learn how to configure robots through route rules. ---- - -If you prefer, you can use route rules to configure how your routes are indexed by search engines. - -You can provide the following rules: - -- `{ robots: false }` - Will disable the route from being indexed using the [robotsDisabledValue](/robots/api/config#robotsdisabledvalue) config. -- `{ robots: }` - Will add the provided string as the robots rule - -The rules are applied using the following logic: -- `X-Robots-Tag` header - SSR only, -- `` - When using the `defineRobotMeta` or `RobotMeta` composable or component -- `/robots.txt` disallow entry - When [disallowNonIndexableRoutes](/robots/api/config#robotsdisabledvalue) is enabled - -## Inline Route Rules - -Requires enabling the experimental `inlineRouteRules`, see the [defineRouteRules](https://nuxt.com/docs/api/utils/define-route-rules) documentation -to learn more. - -```vue - -``` - -## Nuxt Config - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - routeRules: { - // use the `index` shortcut for simple rules - '/secret/**': { robots: false }, - // add exceptions for individual routes - '/secret/visible': { robots: true }, - // use the `robots` rule if you need finer control - '/custom-robots': { robots: 'index, follow' }, - } -}) -``` diff --git a/docs/content/1.robots/2.guides/3.nuxt-config.md b/docs/content/1.robots/2.guides/3.nuxt-config.md deleted file mode 100644 index c326c4e6..00000000 --- a/docs/content/1.robots/2.guides/3.nuxt-config.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: Config using Nuxt Config -description: Learn how to configure the module programmatically using nuxt.config. ---- - -If you need programmatic control, you can configure the module using nuxt.config. - -## Simple Configuration - -The simplest configuration is to provide an array of paths to disallow for the `*` user-agent. If needed you can -provide `allow` pat -You can simply add the path or path pattern to hs as well. - -- `disallow` - An array of paths to disallow for the `*` user-agent. -- `allow` - An array of paths to allow for the `*` user-agent. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - robots: { - // provide simple disallow rules for all robots `user-agent: *` - disallow: ['/secret', '/admin'], - allow: '/admin/login' - } -}) -``` - -This will generate the following output: - -``` -User-agent: * -Disallow: /secret -Disallow: /admin -Allow: /admin/login -``` - -## Group Configuration - -When targeting specific robots, you can use the `groups` option to provide granular control. - -- `groups` - A stack of objects to provide granular control (see below). - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - // add more granular rules - groups: [ - // block specific robots from specific pages - { - userAgent: ['AdsBot-Google-Mobile', 'AdsBot-Google-Mobile-Apps'], - disallow: ['/admin'], - allow: ['/admin/login'], - comments: 'Allow Google AdsBot to index the login page but no-admin pages' - }, - ] -}) -``` - -This will generate the following output: - -``` -# Allow Google AdsBot to index the login page but no-admin pages -User-agent: AdsBot-Google-Mobile -User-agent: AdsBot-Google-Mobile-Apps -Disallow: /admin -Allow: /admin/login -``` diff --git a/docs/content/1.robots/2.guides/_dir.yml b/docs/content/1.robots/2.guides/_dir.yml deleted file mode 100644 index e9454921..00000000 --- a/docs/content/1.robots/2.guides/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Guides diff --git a/docs/content/1.robots/3.api/0.use-robots-rule.md b/docs/content/1.robots/3.api/0.use-robots-rule.md deleted file mode 100644 index 6b3f7151..00000000 --- a/docs/content/1.robots/3.api/0.use-robots-rule.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: useRobotsRule() -description: A reactive way to access and set the robots rule. ---- - -**Type:** `function useRobotsRule(rule?: MaybeRef): Ref` - -View and control the robots rule using a simple reactivity API. - -In a server-side context, this can be used to change the rule used for `X-Robots-Tag` header and the `robots` meta tag. - -In a client-side context you can only read the value of the rule, modifying it will have no effect. This is due to robots only respecting the initial SSR response. - -Note: This does not modify the `/robots.txt` file, only the `X-Robots-Tag` header and the `robots` meta tag. Make sure to update your `robots.txt` file accordingly. - -Providing a `boolean` will either enable or disable indexing for the current path using the default rules. - -## Usage - -**Accessing the rule:** - -```ts -import { useRobotsRule } from '#imports' - -const rule = useRobotsRule() -// Ref<'noindex, nofollow'> -``` - -**Setting the rule - argument:** - -```ts -import { useRobotsRule } from '#imports' - -useRobotsRule('index, nofollow') -// Ref<'index, nofollow'> -useRobotsRule(false) -// Ref<'noindex, nofollow'> -``` - -**Setting the rule - reactive:** - -```ts -import { useRobotsRule } from '#imports' - -const rule = useRobotsRule() -rule.value = 'index, nofollow' -// Ref<'index, nofollow'> -``` diff --git a/docs/content/1.robots/3.api/1.config.md b/docs/content/1.robots/3.api/1.config.md deleted file mode 100644 index 5834e624..00000000 --- a/docs/content/1.robots/3.api/1.config.md +++ /dev/null @@ -1,161 +0,0 @@ ---- -title: Nuxt Config -description: Learn how to configure Nuxt Robots using nuxt.config. ---- - -## `enabled` - -- Type: `boolean` -- Default: `true` -- Required: `false` - -Conditionally toggle the module. - -## `allow` - -- Type: `string[]` -- Default: `[]` -- Required: `false` - -Allow paths to be indexed for the `*` user-agent (all robots). - -## `disallow` - -- Type: `string[]` -- Default: `[]` -- Required: `false` - -Disallow paths from being indexed for the `*` user-agent (all robots). - -## `metaTag` - -- Type: `boolean` -- Default: `true` - -Whether to add a `` tag to the `` of each page. - -## `groups` - -- Type: `{ userAgent: []; allow: []; disallow: []; comments: [] }[]` -- Default: `[]` -- Required: `false` - -Define more granular rules for the robots.txt. Each group is a set of rules for specific user agent(s). - -```ts -export default defineNuxtConfig({ - robots: { - groups: [ - { - userAgent: ['AdsBot-Google-Mobile', 'AdsBot-Google-Mobile-Apps'], - disallow: ['/admin'], - allow: ['/admin/login'], - comments: 'Allow Google AdsBot to index the login page but no-admin pages' - }, - ] - } -}) -``` - -## `sitemap` - -- Type: `string | string[] | false` -- Default: `false` - -The sitemap URL(s) for the site. If you have multiple sitemaps, you can provide an array of URLs. - -You must either define the runtime config `siteUrl` or provide the sitemap as absolute URLs. - -```ts -export default defineNuxtConfig({ - robots: { - sitemap: [ - '/sitemap-one.xml', - '/sitemap-two.xml', - ], - }, -}) -``` - -## `robotsEnabledValue` - -- Type: `string` -- Default: `'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1'` -- Required: `false` - -The value to use when the site is indexable. - -## `robotsDisabledValue` - -- Type: `string` -- Default: `'noindex, nofollow'` -- Required: `false` - -The value to use when the site is not indexable. - -## `disallowNonIndexableRoutes` - -- Type: `boolean` -- Default: `'false'` - -Should route rules which disallow indexing be added to the `/robots.txt` file. - -## `mergeWithRobotsTxtPath` - -- Type: `boolean | string` -- Default: `true` -- Required: `false` - -Specify a robots.txt path to merge the config from, relative to the root directory. - -When set to `true`, the default path of `/robots.txt` will be used. - -When set to `false`, no merging will occur. - -## `blockNonSeoBots` - -- Type: `boolean` -- Default: `false` -- Required: `false` - -Blocks some non-SEO bots from crawling your site. This is not a replacement for a full-blown bot management solution, but it can help to reduce the load on your server. - -See [const.ts](https://github.com/nuxt-modules/robots/blob/main/src/const.ts#L6) for the list of bots that are blocked. - -```ts -export default defineNuxtConfig({ - robots: { - blockNonSeoBots: true - } -}) -``` - -## `debug` - -- Type: `boolean` -- Default: `false` -- Required: `false` - -Enables debug logs and a debug endpoint. - -## `credits` - -- Type: `boolean` -- Default: `true` -- Required: `false` - -Control the module credit comment in the generated robots.txt file. - -```txt -# START nuxt-robots (indexable) <- credits - ... -# END nuxt-robots <- credits -``` - -```ts -export default defineNuxtConfig({ - robots: { - credits: false - } -}) -``` diff --git a/docs/content/1.robots/3.api/1.nuxt-hooks.md b/docs/content/1.robots/3.api/1.nuxt-hooks.md deleted file mode 100644 index 3c677ebc..00000000 --- a/docs/content/1.robots/3.api/1.nuxt-hooks.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: Nuxt Hooks -description: Learn how to use Nuxt hooks to modify the robots config. ---- - -## `robots:config` - -**Type:** `async (config: ResolvedModuleOptions) => void | Promise` - -This hook allows you to modify the robots config before it is used to generate the robots.txt and meta tags. - -```ts -export default defineNuxtConfig({ - hooks: { - 'robots:config': (config) => { - // modify the config - config.sitemap = '/sitemap.xml' - }, - }, -}) -``` diff --git a/docs/content/1.robots/3.api/_dir.yml b/docs/content/1.robots/3.api/_dir.yml deleted file mode 100644 index 91864357..00000000 --- a/docs/content/1.robots/3.api/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Nuxt API diff --git a/docs/content/1.robots/3.nitro-api/0.get-path-robot-config.md b/docs/content/1.robots/3.nitro-api/0.get-path-robot-config.md deleted file mode 100644 index 32a98f3b..00000000 --- a/docs/content/1.robots/3.nitro-api/0.get-path-robot-config.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -title: getPathRobotConfig() -description: Access the robots config for a specific path in Nitro. ---- - -**Type:** `(path: string) => { indexable: boolean; rule: string }` - -Get the robots config for a specific path. - -## Usage - -```ts -import { getPathRobotConfig } from '#imports' - -const { indexable, rule } = getPathRobotConfig('/admin') -``` diff --git a/docs/content/1.robots/3.nitro-api/0.get-site-indexable.md b/docs/content/1.robots/3.nitro-api/0.get-site-indexable.md deleted file mode 100644 index 3caecaba..00000000 --- a/docs/content/1.robots/3.nitro-api/0.get-site-indexable.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: getSiteIndexable() -description: See if the Site is indexable within Nitro. ---- - -**Type:** `() => { indexable: boolean; hints: string[] }` - -Get the robots config for the entire site. - -This is useful for determining if the user has explicitly opted out of indexing the site or -they have a hosted non-production site. - -## Usage - -```ts -import { getSiteIndexable } from '#imports' - -const { indexable, hints } = getSiteIndexable() -``` diff --git a/docs/content/1.robots/3.nitro-api/2.nitro-hooks.md b/docs/content/1.robots/3.nitro-api/2.nitro-hooks.md deleted file mode 100644 index a832f561..00000000 --- a/docs/content/1.robots/3.nitro-api/2.nitro-hooks.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: Nitro Hooks -description: Learn how to use Nitro hooks to modify the robots final output. ---- - -## `robots:config` - -**Type:** - -```ts -interface HookContext { - groups: RobotsGroupResolved[] - sitemaps: string[] - context: 'robots.txt' | 'init' - event?: H3Event // undefined on `init` -} -``` - -Modify the sitemap config before it's used to generate the indexing rules. - -This is called when Nitro starts `init` as well as when generating the robots.txt `robots.txt`. - -```ts [server/plugins/robots-ignore-routes.ts] -export default defineNitroPlugin((nitroApp) => { - nitroApp.hooks.hook('robots:config', async (ctx) => { - // probably want to cache this - const ignoredRoutes = await $fetch('/api/ignored-routes') - ctx.groups[0].disallow.push(...ignoredRoutes) - }) -}) -``` - -## `robots:robots-txt` - -**Type:** - -```ts -interface HookContext { - e: H3Event - robotsTxt: string -} -``` - -This hook allows you to modify the robots.txt content before it is sent to the client. - -```ts [server/plugins/robots-remove-comments.ts] -export default defineNitroPlugin((nitroApp) => { - if (!process.dev) { - nitroApp.hooks.hook('robots:robots-txt', async (ctx) => { - // remove comments from robotsTxt in production - ctx.robotsTxt = ctx.robotsTxt.replace(/^#.*$/gm, '').trim() - }) - } -}) -``` diff --git a/docs/content/1.robots/3.nitro-api/_dir.yml b/docs/content/1.robots/3.nitro-api/_dir.yml deleted file mode 100644 index dd231477..00000000 --- a/docs/content/1.robots/3.nitro-api/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Nitro API diff --git a/docs/content/1.robots/4.releases/0.v3.md b/docs/content/1.robots/4.releases/0.v3.md deleted file mode 100644 index 8019a97c..00000000 --- a/docs/content/1.robots/4.releases/0.v3.md +++ /dev/null @@ -1,130 +0,0 @@ ---- -title: v3.0.0 -description: Release notes for Nuxt Robots v3.0.0. ---- - -## Features :rocket: - -### Robots.txt Config - -The [robots.txt standard](https://developers.google.com/search/docs/crawling-indexing/robots/create-robots-txt) is important for search engines -to understand which pages to crawl and index. - -To match closer to the standard, Nuxt Robots now allows you to configure the module by using a `robots.txt` file. - -```bash [Example File Structure] -public/_robots.txt -``` - -This file will be parsed and used to configure the module. - -If you need programmatic control, you can still configure the module using [nuxt.config.ts](/robots/guides/nuxt-config), -[Route Rules](/robots/guides/route-rules) and [Nitro hooks](/robots/nitro-api/nitro-hooks). - -Read more at [Robots.txt Config](/robots/guides/robots-txt). - -### New Config: `groups` - -- Type: `{ userAgent: []; allow: []; disallow: []; comments: [] }[]` -- Default: `[]` -- Required: `false` - -Define more granular rules for the robots.txt. Each group is a set of rules for specific user agent(s). - -```ts -export default defineNuxtConfig({ - robots: { - groups: [ - { - userAgent: ['AdsBot-Google-Mobile', 'AdsBot-Google-Mobile-Apps'], - disallow: ['/admin'], - allow: ['/admin/login'], - comments: 'Allow Google AdsBot to index the login page but no-admin pages' - }, - ] - } -}) -``` - -### New Config: `blockNonSeoBots` - -- Type: `boolean` -- Default: `false` -- Required: `false` - -Blocks some non-SEO bots from crawling your site. This is not a replacement for a full-blown bot management solution, but it can help to reduce the load on your server. - -See [const.ts](https://github.com/nuxt-modules/robots/blob/main/src/const.ts#L6) for the list of bots that are blocked. - -```ts -export default defineNuxtConfig({ - robots: { - blockNonSeoBots: true - } -}) -``` - -### Improved header / meta tag integration - -Previously, only routes added to the `routeRules` would be used to display the `X-Robots-Tag` header and the `` tag. - -This has been changed to include all `disallow` paths for the `*` user-agent by default. - -### New Config: `credits` - -- Type: `boolean` -- Default: `true` -- Required: `false` - -Control the module credit comment in the generated robots.txt file. - -```txt -# START nuxt-robots (indexable) <- credits - ... -# END nuxt-robots <- credits -``` - -```ts -export default defineNuxtConfig({ - robots: { - credits: false - } -}) -``` - -### New Config: `debug` - -- Type: `boolean` -- Default: `false` -- Required: `false` - -Enables debug logs. - -```ts -export default defineNuxtConfig({ - robots: { - debug: true - } -}) -``` - -## Deprecations - -### Nuxt Site Config Integration - -The module now integrates with the [nuxt-site-config](https://github.com/harlan-zw/nuxt-site-config) module. - -The `siteUrl` and `indexable` config is now deprecated, but will still work. - -For most sites, you won't need to provide any further configuration, everything will just work. -If you need to modify -the default config, the easiest way is to do so through the `site` config. - -```ts -export default defineNuxtConfig({ - site: { - url: 'https://example.com', - indexable: true - } -}) -``` diff --git a/docs/content/1.robots/4.releases/1.v4.md b/docs/content/1.robots/4.releases/1.v4.md deleted file mode 100644 index 45e4c542..00000000 --- a/docs/content/1.robots/4.releases/1.v4.md +++ /dev/null @@ -1,176 +0,0 @@ ---- -title: v4.0.0 -description: Release notes for Nuxt Robots v4.0.0. ---- - -## Nuxt Simple Robots is now Nuxt Robots - -In a [discussion](https://github.com/nuxt-modules/robots/issues/116) with the team and the community, we have decided to migrate `nuxt-simple-robots` into the `@nuxtjs/robots` module. - -This will allow me to better maintain the module and provide a more consistent experience across the Nuxt ecosystem. - -To upgrade simply replace the dependency in `package.json` and update your nuxt.config. - -```diff -- 'nuxt-simple-robots' -+ '@nuxtjs/robots' -``` - -If you're coming from `nuxt-simple-robots` then no other changes are needed. If you're coming from `@nuxtjs/robots` v3, then -the following breaking changes exist. - -### `@nuxtjs/robots` v3 breaking changes - -- The `configPath` config is no longer supported. For custom runtime config you should use [Nitro Hooks](/robots/nitro-api/nitro-hooks). -- The `rules` config is deprecated but will continue to work. Any `BlankLine` or `Comment` rules will no longer work. -- Using `CleanParam`, `CrawlDelay` and `Disavow` requires targeting the [Yandex](/robots/guides/yandex) user agent. - -## :icon{name="i-noto-rocket"} Features - -### useRobotsRule() - -A new Nuxt composable [useRobotsRule()](/robots/api/use-robots-rule) has been introduced to allow you to access and modify the current robots rule for the current route. - -```ts -import { useRobotsRule } from '#imports' - -const rule = useRobotsRule() -// Ref<'noindex, nofollow'> -``` - -### Robots.txt validation :icon{name="i-noto-check-mark-button"} - -When loading in a `robots.txt` file, the module will now validate the file to ensure each of the `disallow` and `allow` paths are valid. - -This will help you avoid errors from Google Search Console and Google Lighthouse. - -### Default Meta Tag :icon{name="i-noto-relieved-face"} - -The module now adds the meta tag to your site by default. The composable and component helpers used to -define this previously have been deprecated. - -```html - - -``` - -Adding the meta tag is important for pages that are prerendered as the `X-Robots-Tag` header is not available. - -You can opt out with `metaTags: false.` - -### I18n Integration :icon{name="i-noto-globe-with-meridians"} - -The module now integrates with [nuxt-i18n](https://i18n.nuxtjs.org/). - -This will automatically re-configure your `allow` and `disallow` rules to include the locale prefix if you have -omitted it. - -```ts -export default defineNuxtConfig({ - robots: { - allow: ['/about'], - disallow: ['/admin'], - }, - i18n: { - strategy: 'prefix_except_default', - locales: ['en', 'fr'], - defaultLocale: 'en', - }, -}) -``` - -```txt -# robots.txt -User-agent: * -Allow: /about -Allow: /fr/about -Disallow: /admin -Disallow: /fr/admin -``` - -Learn more on the [I18n Integration](/robots/integrations/i18n) docs. - -### Nuxt Content Integration :icon{name="i-noto-books"} - -The module now integrates with [@nuxt/content](https://content.nuxt.com/). Allowing you to use the `robots` frontmatter key within your markdown files. - -```md ---- -robots: false ---- -``` - -Learn more on the [Nuxt Content](/robots/integrations/content) docs. - -### Nuxt DevTools Integration :icon{name="i-noto-hammer"} - -The module now integrates with [Nuxt DevTools](https://devtools.nuxt.com/). - -You can visit the Robots tab and see if the current route is indexable, and if not, why. - - - -### New Nitro Hook and Util Exports :icon{name="i-noto-hook"} - -In this version the new hook Nitro hook as introduced `robots:config`. This hook -will let you override the robots.txt data as a JavaScript object, instead of a string. - -Like-wise you can now re-use any of the internal functions to parse, validate and generate -robots.txt data using the `@nuxtjs/robots/util` export. - -```ts -import { parseRobotsTxt } from '@nuxtjs/robots/util' - -export default defineNitroPlugin((nitroApp) => { - nitroApp.hooks.hook('robots:config', async (ctx) => { - if (ctx.context === 'robots.txt') { - const customRobotsTxt = await $fetch('https://example.com/robots.txt') - const parsed = parseRobotsTxt(config) - config.groups = defu(config.groups, parsed.groups) - } - }) -}) -``` - -## Breaking Changes - -### Site Config - -The deprecated Nuxt Config site config keys have been removed: `host`, `siteUrl`, `indexable`. - -You will need to configure these using [Site Config](/site-config/getting-started/background). - -```diff -export default defineNuxtConfig({ - robots: { -- indexable: false, - }, - site: { -+ indexable: false, - } -}) -``` - -## :icon{name="i-noto-warning"} Deprecations - -### `defineRobotMeta()` and `` - -Because the module now uses a default meta tag, the `defineRobotMeta()` function and `` component are deprecated. - -You should remove this from your code. - -### `index` Route Rule - -The `index` route rule has been deprecated in favour of the `robots` rule. This provides -less ambiguity and more control over the rule. - -```diff -export default defineNuxtConfig({ - routeRules: { - '/admin': { -- index: false, -+ robots: false, - } - } -}) -``` diff --git a/docs/content/1.robots/4.releases/_dir.yml b/docs/content/1.robots/4.releases/_dir.yml deleted file mode 100644 index 21e6ce54..00000000 --- a/docs/content/1.robots/4.releases/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Releases diff --git a/docs/content/1.robots/_dir.yml b/docs/content/1.robots/_dir.yml deleted file mode 100644 index b0c46748..00000000 --- a/docs/content/1.robots/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Robots diff --git a/docs/content/10.site-config/0.getting-started/0.background.md b/docs/content/10.site-config/0.getting-started/0.background.md deleted file mode 100644 index 52280d05..00000000 --- a/docs/content/10.site-config/0.getting-started/0.background.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: What is Site Config? -description: Learn about the motivation behind Nuxt Site Config and a bit about how it works. ---- - -Site config aims to be to things: -- A single source of truth for site config, for end-users and module authors. Site config can be considered config that is commonly used amongst modules but is not supported by the Nuxt core. -- A set of APIs for working with "writeable runtime config", for end-users and module authors. - -## Site Config Examples - -### `url` - -A canonical site URL is important for SEO and performance - -### `env` - -The environment the site is running in, importing so we can disable indexing for non-production environments. - -See [this issue](https://github.com/nuxt/nuxt/issues/19819) on why we can't use `process.env.NODE_ENV`. - -### `indexable` - -Can the site be indexed by search engines? Sometimes we have production sites that we don't want to be indexed. - -### `name` - -The name of the site is often used in meta tags and other SEO related tags - -### `trailingSlash` - -Trailing slashes are important for SEO and performance. - -## What's the problem? - -Not having a single source of truth for site config can be difficult to maintain and error-prone, for end-users and module authors. - -Requiring a lot of duplication and boilerplate code to support the same features across modules. - -Nuxt Site Config aims -to unify the experience of site config with a set of powerful and flexible APIs for end-users and module authors. - -## Can't we just use the Request URL or module config? - -Nuxt itself provides a great SSR utility for getting the site URL from the request headers at runtime. - -However, this has two major drawbacks: -- It's not available at build time or when prerendering -- When used for SEO content, it can cause duplicate content issues if the URL is not the canonical URL (e.g. `www.example.com` and `example.com`) - -## Can't we just use `site` on Runtime / App Config? - -Yes. In fact, this module uses `site` on the App Config and Nuxt Config under the hood. - -This module acts as a wrapper around these data sources, as well as: -- Environment variables -- Runtime Config -- Route Rules - -It aims to keep all these in sync, resulting in a single source of truth for site config. - -## How does it work? - -See [How it works](/site-config/getting-started/how-it-works) for more details. - -## End goal - -We should be able to spin up multi-tenant or multi-lingual Nuxt app with minimal effort, and Nuxt modules should just work, without any additional configuration. - -This is quite far off, but it sets a good direction for the module. diff --git a/docs/content/10.site-config/0.getting-started/0.installation.md b/docs/content/10.site-config/0.getting-started/0.installation.md deleted file mode 100644 index 95bda16f..00000000 --- a/docs/content/10.site-config/0.getting-started/0.installation.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: 'Install Nuxt Site Config' -description: 'Get started with Nuxt Site Config by installing the dependency to your project.' -navigation: - title: 'Installation' ---- - -Nuxt Site Config is a module for Nuxt modules. -While you can install it in your own project, it's recommended to use it in a module. - -1. Install `nuxt-site-config` dependency to your project: - -::code-group - -```sh [pnpm] -pnpm i -D nuxt-site-config nuxt-site-config-kit -``` - -```bash [yarn] -yarn add -D nuxt-site-config nuxt-site-config-kit -``` - -```bash [npm] -npm install -D nuxt-site-config nuxt-site-config-kit -``` - -:: - -2. Use the install function in your module: - -```ts [modules.ts] -import { installNuxtSiteConfig, updateSiteConfig } from 'nuxt-site-config-kit' - -export default defineNuxtModule({ - // ... - async setup(options) { - await installNuxtSiteConfig() - - // Optional: set some site config from your modules options - // This is not recommended, only to keep supporting your modules options - updateSiteConfig({ - _context: 'my-module', - url: options.siteUrl, - }) - } -}) -``` - -That's it! Explore the documentation to learn more. diff --git a/docs/content/10.site-config/0.getting-started/3.how-it-works.md b/docs/content/10.site-config/0.getting-started/3.how-it-works.md deleted file mode 100644 index 417fef66..00000000 --- a/docs/content/10.site-config/0.getting-started/3.how-it-works.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: How it works -description: Learn how the Nuxt Site Config module works, so you can get the most out of it. ---- - -# Config Sources - -Site config is resolved from the following sources, in order of precedence: - -## Build Time - -### 1. System - -System details relate to the environment the app is running in. - -```ts -export default { - name: rootDirBaseName, // e.g. '/home/harlan/projects/my-nuxt-app' -> 'my-nuxt-app' - indexable: process.env.NODE_ENV === 'production' -} -``` - -### 2. Package.json - -Site config provided by the package.json file. - -```ts -export default { - name: pkgJson.name, - description: pkgJson.description, -} -``` - -### 3. Vendor Environment Variables - -Environment variables provided by the hosting providers. - -```ts -export default { - url: [ - // vercel, netlify - process.env.NUXT_ENV_VERCEL_URL, - process.env.URL, - // cloudflare pages - process.env.CF_PAGES_URL, - ], - // vercel, netlify - name: [process.env.NUXT_ENV_VERCEL_GIT_REPO_SLUG, process.env.SITE_NAME] -} -``` - -### 4. Module overrides - -Build time site config provided by modules. - -### 5. Nuxt Config `site` key - -Site config provided by the user in the Nuxt config. - -### 6. Runtime Config and Environment Variables - -Site config provided by the user at runtime. `runtimeConfig.public.site` and associated environment variables. - -This will also attempt to use legacy environment variables from Nuxt: -- Private / public runtime config camel cased `siteUrl`, `public.siteUrl` -- Environment variables with and without `PUBLIC`: `NUXT_ENV_SITE_URL`, `NUXT_ENV_PUBLIC_SITE_URL` - -### 7. Nuxt Hook - -The `site-config:resolve` hook is called to allow any final build-time modifications to the config. - -## SSR / Nitro Runtime - -### 1. Request URL - -The request URL is used to determine the site URL at runtime. - -### 2. Build Time Site Config - -Config resolved in the build step. This is stored on the `runtimeConfig.public.site` key. - -### 3. App Config - -Config resolved from the App Config using the `site` key. - -### 4. Route Rules - -Config resolved from the route rules of the request path, the `site` key. This allows for multi-site support. - -## CSR Runtime - -### 1. Browser Context - -Uses the site URL from the `window.location.origin`. - -### 2. SSR Runtime Config - -The SSR runtime config created in the SSR step. This is sent to the client-side to avoid hydration errors. diff --git a/docs/content/10.site-config/0.getting-started/_dir.yml b/docs/content/10.site-config/0.getting-started/_dir.yml deleted file mode 100644 index bcd2ba14..00000000 --- a/docs/content/10.site-config/0.getting-started/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Getting Started diff --git a/docs/content/10.site-config/1.integrations/0.i18n.md b/docs/content/10.site-config/1.integrations/0.i18n.md deleted file mode 100644 index 62420dd3..00000000 --- a/docs/content/10.site-config/1.integrations/0.i18n.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -title: Nuxt I18n -description: How to use the Nuxt Site Config module with Nuxt I18n. ---- - -Out of the box, the Site Config module will integrate directly with [@nuxtjs/i18n v8](https://i18n.nuxtjs.org/). - -## Usage - -By default, it will extract the following properties from the i18n module config. - -- `url` - The base URL, configured as `baseUrl` in the i18n module. -- `currentLocale` - The current locale for the request. This will use the `defaultLocale` if no locale is set. - -For example, consider the following config: - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - i18n: { - baseUrl: 'https://example.com', - defaultLocale: 'en', - locales: [ - { code: 'en', iso: 'en-US' }, - { code: 'fr', iso: 'fr-FR' }, - ], - }, -}) -``` - -The following site config will be inferred: - -```json -{ - "url": "https://example.com", - "currentLocale": "en" -} -``` - -Additionally, it will detect if you have a `nuxtSiteConfig` translation object and use the following properties: -- `name` - Name of the site -- `description` - Description of the site - -For example: - -::code-group - -```ts [locales/en.ts] -export default { - nuxtSiteConfig: { - name: 'My Site', - description: 'My site description', - } -} -``` - -```json [locales/en.json] -{ - "nuxtSiteConfig": { - "name": "My Site", - "description": "My site description" - } -} -``` - -:: - -The following site config will be inferred for an English request: - -```json -{ - "url": "https://example.com", - "currentLocale": "en", - "name": "My Site", - "description": "My site description" -} -``` diff --git a/docs/content/10.site-config/1.integrations/_dir.yml b/docs/content/10.site-config/1.integrations/_dir.yml deleted file mode 100644 index 67b3de90..00000000 --- a/docs/content/10.site-config/1.integrations/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Integrations diff --git a/docs/content/10.site-config/2.guides/0.setting-site-config.md b/docs/content/10.site-config/2.guides/0.setting-site-config.md deleted file mode 100644 index 4e64eee1..00000000 --- a/docs/content/10.site-config/2.guides/0.setting-site-config.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: Recommended Config -description: Learn how to set site config in your Nuxt app. ---- - -Site config can be set from many different sources from each environment. - -For a full list see [how it works](/site-config/getting-started/how-it-works). - -At a minimum, it's recommended you provide a `url`, `env` and `name` for your site. - -## Dev and Live Only - -If you only run your site in development and live environments, you can safely set your site config in your `nuxt.config.ts` file. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - site: { - url: 'https://example.com', - name: 'My Site', - // ...etc - }, -}) -``` - -## Environment-Specific Site Config - -If you have other environments, such as a staging or testing site, then it's recommended to -set your site config using environment variables. - -```bash -NUXT_SITE_URL=https://test.example.com -NUXT_SITE_NAME="STAGING SITE NAME" -NUXT_SITE_ENV="staging" -``` - -## Build Time Site Config - -If you need to set your site config programmatically, you can use the `site-config:resolve` hook. - -```ts -export default defineNuxtConfig({ - hooks: { - 'site-config:resolve': (siteConfig) => { - if (process.env.FOO) - siteConfig.name = 'Bar' - }, - }, -}) -``` - -## Runtime Site Config - -Sometimes you need to set your site config programmatically. This is fully supported, see the [Runtime Site Config](/site-config/guides/runtime-site-config) guide to -learn how. diff --git a/docs/content/10.site-config/2.guides/3.runtime-site-config.md b/docs/content/10.site-config/2.guides/3.runtime-site-config.md deleted file mode 100644 index 7b7e5758..00000000 --- a/docs/content/10.site-config/2.guides/3.runtime-site-config.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: Runtime Site Config -description: Learn how to set site config at runtime in your Nuxt app. ---- - -Site config can be set from many different sources from each environment. - -The most flexible way to set your site config is at runtime. This gives you the ability to set it based on any condition you want, -even allowing multi-tenancy. - -## Caveats - -When setting site config at runtime, it's important to set it as early as possible on the server. - -This is because modules will be using site config to generate your app, for example if you're using Nuxt SEO, site -config is used for `sitemap.xml` and `robots.txt` generation. - -Therefore, it's recommended to set it either within a Nitro plugin or middleware. - -## Plugin - -A Nitro plugin is useful when you want to set site config based on a static condition, such as the environment -or based on a result from a database. - -Because Site Config is attached to a H3 Request context, you will need to use the `site-config:init` hook to set it. - -For example, here we are setting site config based on a database query: - -```ts [server/plugins/update-site-config-from-db.ts] -export default defineNitroPlugin(async (nitroApp) => { - const site = await $fetch('/db/site-config', { - params: { env: import.meta.env.NUXT_SITE_ENV }, - }) - nitroApp.hooks.hook('site-config:init', ({ event, siteConfig }) => { - siteConfig.push(site) - }) -}) -``` - -## Middleware - -If you prefer a simpler API, you can a Nitro middleware instead with `updateSiteConfig` function. - -For example, here we are setting site config based on an admin host: - -```ts [server/middleware/update-site-config.ts] -export default defineRequestMiddleware(async (e) => { - const host = useNitroOrigin(e) - if (host.startsWith('admin.')) { - updateSiteConfig({ - name: 'Admin', - indexable: false, - url: 'https://admin.example.com' - }) - } -}) -``` diff --git a/docs/content/10.site-config/2.guides/_dir.yml b/docs/content/10.site-config/2.guides/_dir.yml deleted file mode 100644 index e9454921..00000000 --- a/docs/content/10.site-config/2.guides/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Guides diff --git a/docs/content/10.site-config/2.guides/debugging.md b/docs/content/10.site-config/2.guides/debugging.md deleted file mode 100644 index 5ed58ad4..00000000 --- a/docs/content/10.site-config/2.guides/debugging.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: Debugging -description: Learn how to debug your site config. ---- - -Nuxt Site Config comes with a Nuxt DevTools integration. The easiest way to debug is to open your DevTools -and navigate to the Site Config tab. - -If you'd like to debug outside of development, you will need to enable the debug mode. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - site: { - debug: true, - }, -}) -``` - -## Debugging Runtime - -Visit the endpoint `/__site-config__/debug.json` to see the current site config debug output. - -## Debugging Build Time - -A static file `/__site-config__/debug.json` is generated at build time. - -You can view this file to see the build time site config debug output. diff --git a/docs/content/10.site-config/4.api/0.site-link.md b/docs/content/10.site-config/4.api/0.site-link.md deleted file mode 100644 index fc4ea09b..00000000 --- a/docs/content/10.site-config/4.api/0.site-link.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: -description: Learn how to use the component. ---- - -This has the exact same API as `` but will normalise the trailing slash based on your site config -as well as providing extra link resolving features. - -```vue - -``` - -Internally this uses the [createSitePathResolver](/site-config/api/create-site-path-resolver) composable. - -## Props - -### `withBase` - -- Type: `Boolean` -- Default: `false` - -When enabled, the `app.baseURL` will be added to the link. - -### `absolute` - -- Type: `Boolean` -- Default: `false` - -Will render the link as an absolute path. - -### `canonical` - -- Type: `Boolean` -- Default: `false` - -When `absolute` is enabled, you can configure whether the URL returned should be canonical or not. - -The non-canonical URL will use the request origin instead of the configured site URL. - -## Component Options - -If needed, you can modify the behaviour of how this component is registered through using Nuxt Config. - -This can be useful for making the component global, allowing it to work in Nuxt Content, or setting a prefix -to avoid collisions with other components. - -```ts -export default defineNuxtConfig({ - site: { - componentOptions: { - prefix: 'I', - global: true, - }, - }, -}) -``` - -```vue - -``` diff --git a/docs/content/10.site-config/4.api/0.use-site-config.md b/docs/content/10.site-config/4.api/0.use-site-config.md deleted file mode 100644 index e52de727..00000000 --- a/docs/content/10.site-config/4.api/0.use-site-config.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: useSiteConfig() -description: How to access site config within a Nuxt context. ---- - -Access the current site config within a Nuxt context. - -## Usage - -```vue [component.vue] - - - -``` - -## API - -### debug - -- Type: `boolean` -- Default: `false` - -Will provide a `_context` object that can be used to track the source of what is setting the site config. - -```ts -export default defineNuxtConfig({ - site: { - name: 'My Site', - }, -}) -``` - -```ts -const siteConfig = useSiteConfig({ debug: true }) -console.log(siteConfig.name, siteConfig._context.name) -// My Site, 'nuxt.config.ts' -``` - -### `resolveRefs` - -- Type: `boolean` -- Default: `false` - -Should any ref values within the site config be resolved when returned. - -### `skipNormalize` - -- Type: `boolean` -- Default: `false` - -Skips the normalizing of the site config, will return it in a raw format in how it was provided. diff --git a/docs/content/10.site-config/4.api/1.update-site-config.md b/docs/content/10.site-config/4.api/1.update-site-config.md deleted file mode 100644 index 85867176..00000000 --- a/docs/content/10.site-config/4.api/1.update-site-config.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: updateSiteConfig() -description: Learn how to modify site config at runtime. ---- - -Modify the site config at runtime. You can provide any config to this function, such as the [recommended config](/site-config/guides/setting-site-config). - -:u-badge{label="Warning" color="amber"} - -When using this, you will to run it as early as possible in the Nuxt lifecycle to avoid conflicts with other modules. -It's recommended to use the Nitro [updateSiteConfig](/site-config/nitro-api/update-site-config) API instead. - -## Usage - -```ts [plugins/site-config.server.ts] -import { updateSiteConfig } from '#imports' - -export default defineNuxtPlugin({ - enforce: 'pre', // make it happen early - setup() { - updateSiteConfig({ - name: 'My Site', - url: 'https://example.com', - }) - } -}) -``` diff --git a/docs/content/10.site-config/4.api/4.create-site-path-resolver.md b/docs/content/10.site-config/4.api/4.create-site-path-resolver.md deleted file mode 100644 index 09d7c7f1..00000000 --- a/docs/content/10.site-config/4.api/4.create-site-path-resolver.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: createSitePathResolver() -description: Create a function to resolve a path relative to the site. ---- - -A utility function to resolve a path in a number of ways while taking into account the `url`, `trailingSlash` and `baseURL` -config. - -## Usage - -```ts -import { createSitePathResolver } from '#imports' - -const resolvePath = createSitePathResolver({ - canonical: true, -}) - -resolvePath('/about') -// https://www.example.com/about -``` - -## API - -### `canonical` - -- Type: `boolean` -- Default: `true` - -Should the path be resolved to the canonical URL using the site config `url`. - -When false, it will resolve to the request host using [useNitroOrigin](/site-config/api/use-nitro-origin). - -### `absolute` - -- Type: `boolean` -- Default: `false` - -Should the path be resolved to an absolute URL. - -### `withBase` - -- Type: `boolean` -- Default: `false` diff --git a/docs/content/10.site-config/4.api/5.use-nitro-origin.md b/docs/content/10.site-config/4.api/5.use-nitro-origin.md deleted file mode 100644 index abc37982..00000000 --- a/docs/content/10.site-config/4.api/5.use-nitro-origin.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: useNitroOrigin() -description: A runtime safe way of accessing the Nitro origin. ---- - -A utility function to get the Nitro origin from the request headers. - -This is a replacement for `useRequestOrigin()` which has edge-cases issues in development, prerendering and in some runtime -environments. - -The nitro origin acts as the canonical origin for the site when a `url` has not been provided. - -## Usage - -```ts -import { useNitroOrigin } from '#imports' - -const origin = useNitroOrigin() -// https://www.example.com -``` diff --git a/docs/content/10.site-config/4.api/_dir.yml b/docs/content/10.site-config/4.api/_dir.yml deleted file mode 100644 index 91864357..00000000 --- a/docs/content/10.site-config/4.api/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Nuxt API diff --git a/docs/content/10.site-config/4.api/config.md b/docs/content/10.site-config/4.api/config.md deleted file mode 100644 index 3792e315..00000000 --- a/docs/content/10.site-config/4.api/config.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: Nuxt Config -description: The config options available for Nuxt Site Config. ---- - -## `enabled` - -- Type: `boolean` -- Default: `true` - -Whether the site config is enabled. - -## `debug` - -- Type: `boolean` -- Default: `false` - -Whether the debug mode of the site config is enabled. - -## `componentOptions` - -- Type: `object` -- Default: `{}` - -Modify the behaviour of how the [<SiteLink>](/site-config/api/site-link) is registered. - -```ts -export default defineNuxtConfig({ - site: { - componentOptions: { - prefix: 'I', - global: true, - }, - }, -}) -``` - -```vue - -``` - -## `url` - -- Type: `string` - -The canonical site URL. - -## `env` - -- Type: `string` -- Default: `process.env.NODE_ENV` - -The environment the site is running in. - -See [this issue](https://github.com/nuxt/nuxt/issues/19819) on why we can't use `process.env.NODE_ENV`. - -## `name` - -- Type: `string` - -The name of the site. - -## `indexable` - -- Type: `boolean` -- Default: `siteConfig.env === 'production' || process.env.NODE_ENV === 'production'` - -Can the site be indexed by search engines. - -## `trailingSlash` - -- Type: `boolean` -- Default: `false` - -Whether to add trailing slashes to the URLs. - -## `description` - -- Type: `string` - -The description of the site. - -## `defaultLocale` - -- Type: `string` - -The default locale of the site. diff --git a/docs/content/10.site-config/4.api/nuxt-hooks.md b/docs/content/10.site-config/4.api/nuxt-hooks.md deleted file mode 100644 index d18e0c58..00000000 --- a/docs/content/10.site-config/4.api/nuxt-hooks.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: Nuxt Hooks -description: Learn how to use Nuxt Hooks to customize your site config. ---- - -## `site-config:resolve` - -**Type:** `async (ctx: SiteConfig) => void | Promise` - -Modify the build time site config after it has been resolved. - -```ts -export default defineNuxtConfig({ - hooks: { - 'site-config:resolve': (siteConfig) => { - if (process.env.FOO) - siteConfig.name = 'Bar' - }, - }, -}) -``` diff --git a/docs/content/10.site-config/4.nitro-api/0.use-site-config.md b/docs/content/10.site-config/4.nitro-api/0.use-site-config.md deleted file mode 100644 index f1cec16d..00000000 --- a/docs/content/10.site-config/4.nitro-api/0.use-site-config.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: useSiteConfig() -description: How to use Site Config within Nitro. ---- - -Same as [useSiteConfig](/site-config/api/use-site-config) but you will need to provide the request context. - -## Usage - -```ts [serverMiddleware.ts] -import { defineEventHandler } from '#imports' - -export default defineEventHandler((e) => { - const siteConfig = useSiteConfig(e) - console.log(siteConfig.name) -}) -``` diff --git a/docs/content/10.site-config/4.nitro-api/1.update-site-config.md b/docs/content/10.site-config/4.nitro-api/1.update-site-config.md deleted file mode 100644 index 72e6abfa..00000000 --- a/docs/content/10.site-config/4.nitro-api/1.update-site-config.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: updateSiteConfig() -description: How to update Site Config within Nitro. ---- - -Same as [updateSiteConfig](/site-config/api/update-site-config) but you will need to provide the request context. - -:u-badge{label="Warning" color="amber"} - -When using this, you will to run it as early as possible within the request lifecycle to avoid conflicts. It's -recommended to run this either in a Nitro plugin or a nitro middleware. - -## Usage - -```ts [serverMiddleware.ts] -import { defineEventHandler } from '#imports' - -export default defineEventHandler((e) => { - updateSiteConfig(e, { - name: 'My Site', - url: 'https://example.com', - }) -}) -``` diff --git a/docs/content/10.site-config/4.nitro-api/3.get-site-indexable.md b/docs/content/10.site-config/4.nitro-api/3.get-site-indexable.md deleted file mode 100644 index 7e5e7804..00000000 --- a/docs/content/10.site-config/4.nitro-api/3.get-site-indexable.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: getSiteIndexable() -description: Access the site config. ---- - -Determine if the site is indexable by search engines. - -This will use the `env`, if it is `production` then it will return `true`, otherwise it will return `false`. - -It can be overridden by providing a `indexable` property in the site config. This allows you to -opt-out of indexing in production. - -## Usage - -```ts -import { getSiteIndexable } from '#imports' - -const indexable = getSiteIndexable(e) -// true -``` diff --git a/docs/content/10.site-config/4.nitro-api/4.create-site-path-resolver.md b/docs/content/10.site-config/4.nitro-api/4.create-site-path-resolver.md deleted file mode 100644 index 81d61034..00000000 --- a/docs/content/10.site-config/4.nitro-api/4.create-site-path-resolver.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: createSitePathResolver() -description: Create a function to resolve a path relative to the site within Nitro. ---- - -Same as [createSitePathResolver()](/site-config/api/create-site-path-resolver) but you will need to provide the request context. - -## Usage - -```ts [serverMiddleware.ts] -import { createSitePathResolver } from '#imports' - -export default defineEventHandler((e) => { - const resolvePath = createSitePathResolver(e, { - canonical: true, - }) - - resolvePath('/about') - // https://www.example.com/about -}) -``` diff --git a/docs/content/10.site-config/4.nitro-api/5.use-nitro-origin.md b/docs/content/10.site-config/4.nitro-api/5.use-nitro-origin.md deleted file mode 100644 index 9ff8ddf8..00000000 --- a/docs/content/10.site-config/4.nitro-api/5.use-nitro-origin.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -title: useNitroOrigin() -description: A runtime safe way of accessing the Nitro origin, within Nitro. ---- - -Same as [useNitroOrigin()](/site-config/api/use-nitro-origin) but you will need to provide the request context. - -## Usage - -```ts [serverMiddleware.ts] -import { useNitroOrigin } from '#imports' - -export default defineEventHandler((e) => { - const origin = useNitroOrigin(e) - // https://www.example.com -}) -``` diff --git a/docs/content/10.site-config/4.nitro-api/_dir.yml b/docs/content/10.site-config/4.nitro-api/_dir.yml deleted file mode 100644 index dd231477..00000000 --- a/docs/content/10.site-config/4.nitro-api/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Nitro API diff --git a/docs/content/10.site-config/4.nitro-api/nitro-hooks.md b/docs/content/10.site-config/4.nitro-api/nitro-hooks.md deleted file mode 100644 index 680fd5df..00000000 --- a/docs/content/10.site-config/4.nitro-api/nitro-hooks.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: Nitro Hooks -description: Learn how to use Nitro Hooks to customize your site config. ---- - -## `site-config:init` - -**Type:** -```ts -export interface HookSiteConfigInitContext { - event: H3Event - siteConfig: SiteConfigStack -} -``` - -Modify site config after it's being initialized. - -```ts [server/plugins/site-config.ts] -export default defineNitroPlugin((nitroApp) => { - nitroApp.hooks.hook('site-config:init', ({ event, siteConfig }) => { - const origin = useNitroOrigin(event) - if (origin.startsWith('fr.')) { - siteConfig.push({ - _context: 'french nitro plugin', // helps you debug - name: 'Mon Site', - url: 'https://fr.example.com', - }) - } - }) -}) -``` diff --git a/docs/content/10.site-config/4.releases/_dir.yml b/docs/content/10.site-config/4.releases/_dir.yml deleted file mode 100644 index 21e6ce54..00000000 --- a/docs/content/10.site-config/4.releases/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Releases diff --git a/docs/content/10.site-config/_dir.yml b/docs/content/10.site-config/_dir.yml deleted file mode 100644 index 27a503ac..00000000 --- a/docs/content/10.site-config/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: OG Image diff --git a/docs/content/0.nuxt-seo/2.guides/0.using-the-modules.md b/docs/content/2.guides/0.using-the-modules.md similarity index 100% rename from docs/content/0.nuxt-seo/2.guides/0.using-the-modules.md rename to docs/content/2.guides/0.using-the-modules.md diff --git a/docs/content/0.nuxt-seo/2.guides/1.configuring-modules.md b/docs/content/2.guides/1.configuring-modules.md similarity index 100% rename from docs/content/0.nuxt-seo/2.guides/1.configuring-modules.md rename to docs/content/2.guides/1.configuring-modules.md diff --git a/docs/content/0.nuxt-seo/2.guides/2.default-meta.md b/docs/content/2.guides/2.default-meta.md similarity index 100% rename from docs/content/0.nuxt-seo/2.guides/2.default-meta.md rename to docs/content/2.guides/2.default-meta.md diff --git a/docs/content/0.nuxt-seo/2.guides/2.fallback-title.md b/docs/content/2.guides/2.fallback-title.md similarity index 100% rename from docs/content/0.nuxt-seo/2.guides/2.fallback-title.md rename to docs/content/2.guides/2.fallback-title.md diff --git a/docs/content/0.nuxt-seo/2.guides/2.redirect-canonical.md b/docs/content/2.guides/2.redirect-canonical.md similarity index 100% rename from docs/content/0.nuxt-seo/2.guides/2.redirect-canonical.md rename to docs/content/2.guides/2.redirect-canonical.md diff --git a/docs/content/0.nuxt-seo/2.guides/2.title-templates.md b/docs/content/2.guides/2.title-templates.md similarity index 100% rename from docs/content/0.nuxt-seo/2.guides/2.title-templates.md rename to docs/content/2.guides/2.title-templates.md diff --git a/docs/content/0.nuxt-seo/2.guides/3.trailing-slashes.md b/docs/content/2.guides/3.trailing-slashes.md similarity index 100% rename from docs/content/0.nuxt-seo/2.guides/3.trailing-slashes.md rename to docs/content/2.guides/3.trailing-slashes.md diff --git a/docs/content/0.nuxt-seo/2.guides/4.i18n.md b/docs/content/2.guides/4.i18n.md similarity index 100% rename from docs/content/0.nuxt-seo/2.guides/4.i18n.md rename to docs/content/2.guides/4.i18n.md diff --git a/docs/content/0.nuxt-seo/2.guides/_dir.yml b/docs/content/2.guides/_dir.yml similarity index 100% rename from docs/content/0.nuxt-seo/2.guides/_dir.yml rename to docs/content/2.guides/_dir.yml diff --git a/docs/content/0.nuxt-seo/2.seo-guides/1.going-live.md b/docs/content/2.seo-guides/1.going-live.md similarity index 100% rename from docs/content/0.nuxt-seo/2.seo-guides/1.going-live.md rename to docs/content/2.seo-guides/1.going-live.md diff --git a/docs/content/0.nuxt-seo/2.seo-guides/_dir.yml b/docs/content/2.seo-guides/_dir.yml similarity index 100% rename from docs/content/0.nuxt-seo/2.seo-guides/_dir.yml rename to docs/content/2.seo-guides/_dir.yml diff --git a/docs/content/2.sitemap/0.getting-started/1.installation.md b/docs/content/2.sitemap/0.getting-started/1.installation.md deleted file mode 100644 index 6f7ead9f..00000000 --- a/docs/content/2.sitemap/0.getting-started/1.installation.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: 'Install Nuxt Sitemap' -description: 'Get started with Nuxt Sitemap by installing the dependency to your project.' -navigation: - title: 'Installation' ---- - -1. Install `@nuxtjs/sitemap` dependency to your project: - -```bash -npx nuxi@latest module add sitemap -``` - -2. Set Site Config - -It's recommended to always set a canonical site URL to avoid duplicate content issues. - -You can set your site URL in [many ways](/site-config/guides/setting-site-config), the easiest is `nuxt.config` or `.env`: - -While optional, it's also recommended to set a `name` as this will be displayed on your sitemap. - -::code-group - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - site: { - url: 'https://example.com', - name: 'My Awesome Website' - }, -}) -``` - -```bash [.env] -NUXT_PUBLIC_SITE_URL=https://example.com -``` -:: - -Sitemap URLs will have their [trailing slashes](/nuxt-seo/guides/trailing-slashes) removed by default. If you want to keep them, you can set the `trailingSlash` option to `true`: - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - site: { - // optional: only if you have trailing slashes enabled - trailingSlash: true - }, -}) -``` - -3. Preview your Sitemap - -After you've set up the module, if you visit `/sitemap.xml` you can see the generated sitemap. - -This has been generated with [Application Sources](/sitemap/getting-started/data-sources). - -4. Next Steps - -- You may want to add your own sources, see [Dynamic URLs](/sitemap/guides/dynamic-urls). -- Have 1000's of pages? Consider using [Multiple Sitemaps](/sitemap/guides/multi-sitemaps). -- Ready to go Live? See [Submitting Your Sitemap](/sitemap/guides/submitting-sitemap). diff --git a/docs/content/2.sitemap/0.getting-started/2.data-sources.md b/docs/content/2.sitemap/0.getting-started/2.data-sources.md deleted file mode 100644 index 29981b51..00000000 --- a/docs/content/2.sitemap/0.getting-started/2.data-sources.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -title: Data Sources -description: Learn how the Nuxt Sitemap sources work. ---- - -Every URL within your sitemap will belong to a source. - -A source will either be a User source or a Application source. - -## Application Sources - -Application sources are sources generated automatically from your app. These are in place to make using the module more -convenient but may get in the way. - -- `nuxt:pages` - Statically analysed pages of your application -- `nuxt:prerender` - URLs that were prerendered -- `nuxt:route-rules` - URLs from your route rules -- `@nuxtjs/i18n:pages` - When using the `pages` config with Nuxt I18n. See [Nuxt I18n](/sitemap/integrations/i18n) for more details. -- `@nuxt/content:document-driven` - When using Document Driven mode. See [Nuxt Content](/sitemap/integrations/content) for more details. - -### Disabling application sources - -You can opt out of application sources individually or all of them by using the `excludeAppSources` config. - -::code-group - -```ts [Disable all app sources] -export default defineNuxtConfig({ - sitemap: { - // exclude all app sources - excludeAppSources: true, - } -}) -``` - -```ts [Disable pages app source] -export default defineNuxtConfig({ - sitemap: { - // exclude static pages - excludeAppSources: ['nuxt:pages'], - } -}) -``` - -:: - -## User Sources - -When working with a site that has dynamic routes that isn't using [prerendering discovery](/sitemap/guides/prerendering), you will need to provide your own sources. - -For this, you have a few options: - -## 1. Build time: provide a `urls` function - -If you only need your sitemap data concurrent when you build, then providing a `urls` function is the simplest way to provide your own sources. - -This function will only be run when the sitemap is generated. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - sitemap: { - urls: async () => { - // fetch your URLs from a database or other source - const urls = await fetch('https://example.com/api/urls') - return urls - } - } -}) -``` - -### 2. Runtime: provide a `sources` array - -If you need your sitemap data to always be up-to-date at runtime, you will need to provide your own sources explicitly. - -A source is a URL that will be fetched and is expected to return an array of Sitemap URL entries. - -::code-group - -```ts [Single Sitemap] -export default defineNuxtConfig({ - sitemap: { - sources: [ - // create our own API endpoints - '/api/__sitemap__/urls', - // use a static remote file - 'https://cdn.example.com/my-urls.json', - // hit a remote API with credentials - ['https://api.example.com/pages/urls', { headers: { Authorization: 'Bearer ' } }] - ] - } -}) -``` - -```ts [Multiple Sitemaps] -export default defineNuxtConfig({ - sitemap: { - sitemaps: { - foo: { - sources: [ - '/api/__sitemap__/urls/foo', - ] - }, - bar: { - sources: [ - '/api/__sitemap__/urls/bar', - ] - } - } - } -}) -``` - -:: - -You can provide any number of sources, however, you should consider your own caching strategy. - -You can learn more about data sources on the [Dynamic URLs](/sitemap/guides/dynamic-urls) guide. diff --git a/docs/content/2.sitemap/0.getting-started/3.stackblitz.md b/docs/content/2.sitemap/0.getting-started/3.stackblitz.md deleted file mode 100644 index 5178e022..00000000 --- a/docs/content/2.sitemap/0.getting-started/3.stackblitz.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -title: "Reproductions: Stackblitz" -description: Create minimal reproductions for Nuxt Sitemap or just experiment with the module. ---- - -You can use the Nuxt Sitemap Stackblitz playgrounds for either: -- Playing around with the module in a sandbox environment -- Making reproductions for issues (Learn more about [Why Reproductions are Required](https://antfu.me/posts/why-reproductions-are-required)) - -## Stackblitz Playgrounds - -- [Dynamic URLs](https://stackblitz.com/edit/nuxt-starter-dyraxc?file=server%2Fapi%2F_sitemap-urls.ts) -- [i18n](https://stackblitz.com/edit/nuxt-starter-jwuie4?file=app.vue) -- [Manual Chunking](https://stackblitz.com/edit/nuxt-starter-umyso3?file=nuxt.config.ts) -- [Nuxt Content Document Driven](https://stackblitz.com/edit/nuxt-starter-a5qk3s?file=nuxt.config.ts) diff --git a/docs/content/2.sitemap/0.getting-started/4.faq.md b/docs/content/2.sitemap/0.getting-started/4.faq.md deleted file mode 100644 index 5b3cb7a0..00000000 --- a/docs/content/2.sitemap/0.getting-started/4.faq.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: FAQ -description: Frequently asked questions about Nuxt Sitemap. ---- - -## Why is my browser not rendering the XML properly? - -When disabling the [XSL](/sitemap/guides/customising-ui#disabling-the-xls) (XML Stylesheet) in, the XML will -be rendered by the browser. - -If you have a i18n integration, then it's likely you'll see your sitemap look raw text instead of XML. - -![Broken XML because of xhtml namespace.](/sitemap/formatting-error.png) - -This is a [browser bug](https://bugs.chromium.org/p/chromium/issues/detail?id=580033) in parsing the `xhtml` namespace which is required to add localised URLs to your sitemap. -There is no workaround besides re-enabled the XSL. - -## Google Search Console shows Error when submitting my Sitemap? - -Seeing "Error" when submitting a new sitemap is common. This is because Google previously -crawled your site for a sitemap and found nothing. - -If your sitemap is [validating](https://www.xml-sitemaps.com/validate-xml-sitemap.html) correctly, then you're all set. -It's best to way a few days and check back. In nearly all cases, the error will resolve itself. diff --git a/docs/content/2.sitemap/0.getting-started/_dir.yml b/docs/content/2.sitemap/0.getting-started/_dir.yml deleted file mode 100644 index bcd2ba14..00000000 --- a/docs/content/2.sitemap/0.getting-started/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Getting Started diff --git a/docs/content/2.sitemap/1.integrations/0.i18n.md b/docs/content/2.sitemap/1.integrations/0.i18n.md deleted file mode 100644 index 663933dc..00000000 --- a/docs/content/2.sitemap/1.integrations/0.i18n.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: Nuxt I18n -description: How to use the Nuxt Sitemap module with Nuxt I18n. ---- - -Out of the box, the sitemap module will integrate directly with [@nuxtjs/i18n](https://i18n.nuxtjs.org/). -You will need to use v8+ of the i18n module. - -I18n configuration can get quite complicated, so it's important to figure out what mode you're using. - -## Modes - -### Automatic I18n Multi Sitemap - -When certain conditions are met then the sitemap module will automatically generate a sitemap for each locale: -- If you're not using `no_prefix` strategy -- Or if you're using [Different Domains](https://i18n.nuxtjs.org/docs/v7/different-domains), -- And you haven't configured the `sitemaps` option - -This looks like: -```shell -> ./sitemap_index.xml -> ./en-sitemap.xml -> ./fr-sitemap.xml -# ...etc -``` - -These sitemaps will include [app sources](/sitemap/getting-started/data-sources). The `nuxt:pages` source -will automatically determine the correct `alternatives` for your pages. - -If you need to opt-out of app sources, use `excludeAppSources: true`. - -### I18n Pages - -If you have enabled `i18n.pages` in your i18n configuration, then the sitemap module will automatically generate a single sitemap -using the configuration. - -This sitemap will not include [app sources](/sitemap/getting-started/data-sources). - -You can add additional URLs using `sources`. - -## Dynamic URLs with i18n - -To simplify the sitemap output, any dynamic URLs you provided will not have i18n data and will exist -only within the default locale sitemap. - -To help you with this, the module provides two options: `_i18nTransform` and `_sitemap`. - -### `_i18nTransform` - -If you want the module to convert a single URL into all of its i18n variants, you can provide the `_i18nTransform: true` option. - -```ts [server/api/__sitemap__/urls.ts] -export default defineSitemapEventHandler(() => { - return [ - { - loc: '/about-us', - // will be transformed into /en/about-us and /fr/about-us - _i18nTransform: true, - } - ] -}) -``` - -### `_sitemap` - -Alternatively, you can specify which locale sitemap you want to include the URL in using `_sitemap`. - -```ts [server/api/__sitemap__/urls.ts] -export default defineSitemapEventHandler(() => { - return [ - { - loc: '/about-us', - _sitemap: 'en', - } - ] -}) -``` - -## Debugging Hreflang - -By default, the XML stylesheet doesn't show you the hreflang tags. You will need to view the page source to see them. - -Don't worry, these are still visible to search engines. - -If you'd like to visually see the hreflang tag counts, you can [Customise the UI](/sitemap/guides/customising-ui). - -```ts -export default defineNuxtConfig({ - sitemap: { - xslColumns: [ - { label: 'URL', width: '50%' }, - { label: 'Last Modified', select: 'sitemap:lastmod', width: '25%' }, - { label: 'Hreflangs', select: 'count(xhtml)', width: '25%' }, - ], - } -}) -``` diff --git a/docs/content/2.sitemap/1.integrations/1.content.md b/docs/content/2.sitemap/1.integrations/1.content.md deleted file mode 100644 index d4c73908..00000000 --- a/docs/content/2.sitemap/1.integrations/1.content.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -title: Nuxt Content -description: How to use the Nuxt Sitemap module with Nuxt Content. ---- - -Nuxt Sitemap integrates with Nuxt Content out of the box. - -It comes with automatic configuration when using document driven mode. -Otherwise, you can opt in on each markdown file or set up your own [app source](/sitemap/getting-started/data-sources). - -## Setup - -### Document Driven Mode - -When using `documentDriven` mode, all paths will be automatically added to the sitemap. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - // things just work! - content: { - documentDriven: true - } -}) -``` - -If you're not using `documentDriven` mode and your content paths are the same as their real paths, -you can enable `strictNuxtContentPaths` to get the same behaviour. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - sitemap: { - strictNuxtContentPaths: true - } -}) -``` - -### Markdown opt in - -If you want to add markdown pages to your sitemap without any extra config, you can use the `sitemap` key on -your frontmatter. You must provide a `loc` value, or the page must have a `path`. - -```md ---- -sitemap: - loc: /my-page - lastmod: 2021-01-01 - changefreq: monthly - priority: 0.8 ---- - -# My Page -``` - -### Nuxt Content App Source - -If you'd like to set up a more automated Nuxt Content integration and your not using Document Driven mode, you can add content to the sitemap as you would with [Dynamic URLs](/sitemap/guides/dynamic-urls). - -An example of what this might look like is below, customize to your own needs. - -```ts [server/api/__sitemap__/urls.ts] -import { defineEventHandler } from 'h3' -import type { ParsedContent } from '@nuxt/content/dist/runtime/types' -import { serverQueryContent } from '#content/server' -import { asSitemapUrl, defineSitemapEventHandler } from '#imports' - -export default defineSitemapEventHandler(async (e) => { - const contentList = (await serverQueryContent(e).find()) as ParsedContent[] - return contentList - .filter(c => c._path.startsWith('_articles')) - .map((c) => { - return asSitemapUrl({ - loc: `/blog/${c._path.replace('_articles', '')}`, - lastmod: updatedAt - }) - }) -}) -``` - -```ts -export default defineNuxtConfig({ - sitemap: { - sources: [ - '/api/__sitemap__/urls' - ] - } -}) -``` - -## Guides - -### Opt out from Sitemap - -You can also disable the content from being used by passing in `sitemap: false` or `robots: false`. diff --git a/docs/content/2.sitemap/1.integrations/2.robots.md b/docs/content/2.sitemap/1.integrations/2.robots.md deleted file mode 100644 index 56dc80ee..00000000 --- a/docs/content/2.sitemap/1.integrations/2.robots.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: Nuxt Robots -description: How to use the Nuxt Robots module with Nuxt Content. ---- - -The [@nuxtjs/robots](https://github.com/nuxt-modules/robots) module is useful for creating a dynamic runtime robots.txt file. - -## Setup - -The module will automatically handle the correct URL to add to the robots.txt, even when using -multiple sitemaps. - -There are no extra steps needed. diff --git a/docs/content/2.sitemap/1.integrations/_dir.yml b/docs/content/2.sitemap/1.integrations/_dir.yml deleted file mode 100644 index 67b3de90..00000000 --- a/docs/content/2.sitemap/1.integrations/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Integrations diff --git a/docs/content/2.sitemap/2.guides/0.filtering-urls.md b/docs/content/2.sitemap/2.guides/0.filtering-urls.md deleted file mode 100644 index 15c1a79e..00000000 --- a/docs/content/2.sitemap/2.guides/0.filtering-urls.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -title: Disabling Indexing -description: How to filter the URLs generated from application sources. ---- - -When viewing your sitemap.xml for the first time, you may notice some URLs you don't want to be included. - -These URLs are most likely coming from [Application Sources](/sitemap/getting-started/data-sources). - -If you don't want to disable these sources but want to remove these URLs you have a couple of options. - -## Disabling Page Indexing - -If you don't want a URL in your sitemap because you don't want search engines to crawl it, -then you can make use of the `index` route rule. - -To actually block search engines, you will need to use this with the [Nuxt Robots](/robots/getting-started/installation) module. - -### Disabling indexing for a pattern of URLs - -If you have a pattern of URLs that you want hidden from search you can use route rules. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - routeRules: { - // Don't add any /secret/** URLs to the sitemap.xml - '/secret/**': { robots: false }, - } -}) -``` - -### Disabling indexing for a Page - -If you just have some specific pages, you can use the experimental [`defineRouteRules`](https://nuxt.com/docs/api/utils/define-route-rules) - -```vue - -``` - -## Filter URLs with include / exclude - -For all other cases, you can use the `include` and `exclude` module options to filter URLs. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - sitemap: { - // exclude all URLs that start with /secret - exclude: ['/secret/**'], - // include all URLs that start with /public - include: ['/public/**'], - } -}) -``` - -Either option supports either an array of strings, RegExp objects or a `{ regex: string }` object. - -Providing strings will use the [route rules path matching](https://nuxt.com/docs/guide/concepts/rendering#hybrid-rendering) which -does not support variable path segments in front of static ones. - -For example, `/foo/**` will work but `/foo/**/bar` will not. To get around this you should use regex. - -### Regex Filtering - -Filtering using regex is more powerful and can be used to match more complex patterns. It's recommended to pass a -`RegExp` object explicitly. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - sitemap: { - exclude: [ - // exclude /foo/**/bar using regex - new RegExp('/foo/.*/bar') - ], - } -}) -``` diff --git a/docs/content/2.sitemap/2.guides/0.lastmod.md b/docs/content/2.sitemap/2.guides/0.lastmod.md deleted file mode 100644 index ea0a61e7..00000000 --- a/docs/content/2.sitemap/2.guides/0.lastmod.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: Setting Lastmod -description: Learn how to set the lastmod of your sitemap URLs. ---- - -In some cases you'll want to set the `lastmod`, `changefreq`, or `priority` of your sitemap URLs. To -do this, you have a few options depending on your setup. - -See [Best Practices](/sitemap/guides/best-practices) for details on how to optimize these values. - -## Page Meta - -Support for configuring these values through `definePageMeta` is coming soon. - -## Prerendering Lastmod - -When prerendering your site, you can make use of setting the `article:modified_time` meta tag in your page's head. This -meta tag will be used as the `lastmod` value in your sitemap. - -```vue [pages/index.vue] - -``` - -## Route Rules - -A more general approach is to use [Route rules](https://nuxt.com/docs/api/configuration/nuxt-config/#routerules). - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - routeRules: { - '/about': { sitemap: { changefreq: 'daily', priority: 0.3 } } - } -}) -``` - -Alternatively, you can use the [defineRouteRules](https://nuxt.com/docs/api/utils/define-route-rules) helper on specific pages. - -```vue [pages/index.vue] - -``` - -Using `defineRouteRules` feature is experimental and in order to use it you must enable the `experimental.inlineRouteRules` option in your nuxt.config. diff --git a/docs/content/2.sitemap/2.guides/1.multi-sitemaps.md b/docs/content/2.sitemap/2.guides/1.multi-sitemaps.md deleted file mode 100644 index 4bbb090d..00000000 --- a/docs/content/2.sitemap/2.guides/1.multi-sitemaps.md +++ /dev/null @@ -1,206 +0,0 @@ ---- -title: Multi Sitemaps -description: Generate multiple sitemaps for different sections of your site. ---- - -The module will generate a single `/sitemap.xml` file by default, for most websites this is perfect. - -However, for larger sites that start having over thousands of URLs, introducing multiple sitemaps can help -you to debug your sitemap easier and also help search engines to crawl your site more efficiently. - -## Enabling Multiple Sitemaps - -If you want to generate multiple sitemaps, you can use the `sitemaps` option, which has two options: -- `object` - Enables manual chunking. Recommended when you have clear content types (pages, posts, etc) or less than 1000 URLs -- `true` - Enables automatic chunking. Recommended when you have a more than 1000 URLs and don't have clear content types. - -::code-group - -```ts [Manual Chunking] -export default defineNuxtConfig({ - sitemap: { - // manually chunk into multiple sitemaps - sitemaps: { - posts: { - include: [ - '/blog/**', - ], - // example: give blog posts slightly higher priority (this is optional) - defaults: { priority: 0.7 }, - }, - pages: { - exclude: [ - '/blog/**', - ] - }, - }, - }, -}) -``` - -```ts [Automatic Chunking] -export default defineNuxtConfig({ - sitemap: { - sitemaps: true, - // modify the chunk size if you need - defaultSitemapsChunkSize: 2000 // default 1000 - }, -}) -``` - -:: - -## Manual Chunking - -When manually chunking your sitemaps, there are multiple ways of handling it depending on what you need. - -In either case, if you'd like to provide defaults for URLs within the sitemap you can use the `defaults` option. - -- `defaults` - Sitemap default values such as `lastmod`, `changefreq`, or `priority` - -```ts -export default defineNuxtConfig({ - sitemap: { - sitemaps: { - posts: { - // posts low priority - defaults: { priority: 0.7 }, - }, - }, - }, -}) -``` - -### Extending App Sources - -When your single sitemap contains all the correct URLs and you just want to split them up into separate sitemaps, -you can extend the [app sources](/sitemap/getting-started/data-sources) and [filter the URLs](/sitemap/guides/filtering-urls). - -- `includeAppSources` - Uses [app sources](/sitemap/getting-started/data-sources) -- `includeGlobalSources` - Uses [global sources](/sitemap/getting-started/data-sources) -- `include` - Array of glob patterns to include in the sitemap -- `exclude` - Array of glob patterns to exclude from the sitemap - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - sitemap: { - sitemaps: { - pages: { - // extend the nuxt:pages app source - includeAppSources: true, - // filter the URLs to only include pages - exclude: ['/blog/**'], - }, - posts: { - // extend the nuxt:pages app source - includeAppSources: true, - // filter the URLs to only include pages - include: ['/blog/**'], - }, - }, - }, -}) -``` - -If you're using a global `sitemap.sources` and need to filter URLs further, then you can use the `_sitemap` key. - -- `_sitemap` - The name of the sitemap that the URL should be included in - -::code-group - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - sitemap: { - sources: [ - '/api/sitemap-urls' - ], - sitemaps: { - pages: { - includeGlobalSources: true, - includeAppSources: true, - exclude: ['/**'] - // ... - }, - }, - }, -}) -``` - -```ts [server/api/sitemap-urls.ts] -export default defineSitemapEventHandler(() => { - return [ - { - loc: '/about-us', - // will end up in the pages sitemap - _sitemap: 'pages', - } - ] -}) -``` - -:: - -### Managing Sources - -If you need to fetch the URLs from an endpoint for a sitemap, then you will need to use either the `urls` or `sources` option. - -- `urls` - Array of static URLs to include in the sitemap. You should avoid using this option if you have a lot of URLs -- `sources` - Custom endpoint to fetch [dynamic URLs](/sitemap/guides/dynamic-urls) from. - -```ts -export default defineNuxtConfig({ - sitemap: { - sitemaps: { - posts: { - urls() { - // resolved when the sitemap is shown - return ['/foo', '/bar'] - }, - sources: [ - '/api/sitemap-urls' - ] - }, - }, - }, -}) -``` - -### Linking External Sitemaps - -This mode also provides a special key called `index` which allows you to easily extend the index sitemap. This can be useful -for adding an external sitemap. - -```ts -export default defineNuxtConfig({ - sitemaps: { - // generated sitemaps - posts: { - // ... - }, - pages: { - // ... - }, - // extending the index sitemap with an external sitemap - index: [ - { sitemap: 'https://www.google.com/sitemap-pages.xml' } - ] - } -}) -``` - -## Automatic Chunking - -This will automatically chunk your sitemap into multiple-sitemaps, using the `0-sitemap.xml`, `1-sitemap.xml` naming convention. - -It will be chunked on the `defaultSitemapsChunkSize` option, which defaults to 1000 URLs per sitemap. - -You should avoid using this if you have less than 1000 URLs. - -```ts -export default defineNuxtConfig({ - sitemap: { - // automatically chunk into multiple sitemaps - sitemaps: true, - }, -}) -``` diff --git a/docs/content/2.sitemap/2.guides/2.dynamic-urls.md b/docs/content/2.sitemap/2.guides/2.dynamic-urls.md deleted file mode 100644 index 6b7ea9a0..00000000 --- a/docs/content/2.sitemap/2.guides/2.dynamic-urls.md +++ /dev/null @@ -1,135 +0,0 @@ ---- -title: Dynamic URL Endpoint -description: Use runtime API endpoints to generate dynamic URLs for your sitemap. ---- - -In some instances, like using a CMS, you may need to implement an endpoint to make -all of your site URLs visible to the module. - -To do this, you can provide [user sources](/sitemap/getting-started/data-sources) to the module. - -## Dynamic URLs from an external API - -## Fetching from an external API - -When you have a source that is a third-party API returning dynamic URLs,then you have a couple of options. - -1. Add the endpoint directly to the `sources` config - Good for endpoints that return the data already in the correct format -2. Make an API endpoint that returns the URLs - Required when you have to transform the data or implement your own caching - -### 1. Using sources config - -If the URL you're fetching from requires any extra headers to work, you can provide a source as an array, where the second -option is the fetch options. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - sitemap: { - sources: [ - // fetch from an unauthenticated endpoint - 'https://api.example.com/pages/urls', - // fetch from an authenticated endpoint - [ - 'https://authenticated-api.example.com/pages/urls', - { headers: { Authorization: 'Bearer ' } } // fetch options - ] - ] - } -}) -``` - -### 2. Create your own endpoint - -1. Create a new API endpoint - -In this code snippet we're using the `defineSitemapEventHandler` helper to create a new API endpoint. -This is a simple wrapper for `defineEventHandler` that forces the TypeScript types. - -::code-group - -```ts [Simple] -// server/api/__sitemap__/urls.ts -export default defineSitemapEventHandler(() => { - return [ - { - loc: '/about-us', - // will end up in the pages sitemap - _sitemap: 'pages', - } - ] -}) -``` - -```ts [Multiple Sitemaps] -export default defineSitemapEventHandler(async () => { - const [ - posts, - pages, - ] = await Promise.all([ - // - $fetch('/api/posts') - .then(posts => posts.map(p => ({ - loc: p.slug, - // only if you're using manual chunking with app sources - _sitemap: 'posts' - }))), - $fetch('/api/pages'), - ]) - return [...posts, ...pages, ...products].map((p) => { - return { loc: p.url, lastmod: p.updatedAt } - }) -}) -``` - -:: - -To solve type issues you have in using `defineSitemapEventHandler`, you can use the `asSitemapUrl` composable. - -```ts [server/api/__sitemap__/urls.ts] -import { asSitemapUrl, defineSitemapEventHandler } from '#imports' - -export default defineSitemapEventHandler(async () => { - // fetch data directly in the correct type - const posts = await $fetch>('/api/posts') - const pages = await $fetch<{ pages: { slug: string, title: string } }>('/api/posts') - return [ - ...posts, - // map URLS as needed - ...pages.map(p => asSitemapUrl({ - loc: p.slug, - })) - ] -}) -``` - -If you still have TypeScript errors, you should just use `defineEventHandler`. - -2. Add the endpoint to your `nuxt.config.ts` - -::code-group - -```ts [Single Sitemap Sources] -export default defineNuxtConfig({ - sitemap: { - sources: [ - '/api/__sitemap__/urls', - ] - } -}) -``` - -```ts [Multi Sitemap Sources] -export default defineNuxtConfig({ - sitemap: { - sitemaps: { - posts: { - sources: [ - '/api/__sitemap__/urls/posts', - ] - } - } - } -}) -``` - -:: diff --git a/docs/content/2.sitemap/2.guides/2.images-videos.md b/docs/content/2.sitemap/2.guides/2.images-videos.md deleted file mode 100644 index 4cdee6de..00000000 --- a/docs/content/2.sitemap/2.guides/2.images-videos.md +++ /dev/null @@ -1,180 +0,0 @@ ---- -title: Images & Videos -description: Learn how to add images and videos in your sitemap. ---- - -Generated sitemaps are given the `image` and `video` namespaces by default. This allows you to add images and videos to your sitemap. - -## Images - -To add images to your sitemap, you can use the `images` property on the sitemap entry. - -You can learn more about images in sitemaps on the [Google documentation](https://developers.google.com/search/docs/advanced/sitemaps/image-sitemaps). - -```ts -export interface ImageEntry { - loc: string -} -``` - -You can implement this as follows: - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - sitemap: { - urls: [ - { - loc: '/blog/my-post', - images: [ - { - loc: 'https://example.com/image.jpg', - caption: 'My image caption', - geoLocation: 'My image geo location', - title: 'My image title', - license: 'My image license', - } - ] - } - ] - } -}) -``` - -### Automatic Image Discovery - -When you prerender your pages, the module can discover images in your page and add them to your sitemap automatically. - -To enable this, you must have a `
` tag in your layout that will be scanned for images. This is to avoid adding images from your header and footer. - -## Videos - -To add videos to your sitemap, you can use the `videos` property on the sitemap entry. - -The TypeScript interface for videos is as follows: - -```ts -export interface VideoEntry { - title: string - thumbnail_loc: string | URL - description: string - content_loc?: string | URL - player_loc?: string | URL - duration?: number - expiration_date?: Date | string - rating?: number - view_count?: number - publication_date?: Date | string - family_friendly?: 'yes' | 'no' | boolean - restriction?: Restriction - platform?: Platform - price?: ({ - price?: number | string - currency?: string - type?: 'rent' | 'purchase' | 'package' | 'subscription' - })[] - requires_subscription?: 'yes' | 'no' | boolean - uploader?: { - uploader: string - info?: string | URL - } - live?: 'yes' | 'no' | boolean - tag?: string | string[] -} -``` - -You can learn more about videos in sitemaps on the [Google documentation](https://developers.google.com/search/docs/advanced/sitemaps/video-sitemaps). - -You can implement this as follows: - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - sitemap: { - urls: [ - { - loc: '/blog/my-post', - videos: [ - { - title: 'My video title', - thumbnail_loc: 'https://example.com/video.jpg', - description: 'My video description', - content_loc: 'https://example.com/video.mp4', - player_loc: 'https://example.com/video.mp4', - duration: 600, - expiration_date: '2021-01-01', - rating: 4.2, - view_count: 1000, - publication_date: '2021-01-01', - family_friendly: true, - restriction: { - relationship: 'allow', - country: 'US', - }, - platform: { - relationship: 'allow', - platform: 'web', - date: '2021-01-01', - }, - price: [ - { - price: 1.99, - currency: 'USD', - type: 'rent', - } - ], - requires_subscription: true, - uploader: { - uploader: 'My video uploader', - info: 'https://example.com/uploader', - }, - live: true, - tag: ['tag1', 'tag2'], - } - ] - } - ] - } -}) -``` - -### Automatic Video Discovery - -Like automatic image discovery, you can opt-in to automatic video discovery including video markup in your `
` tag. - -You are also required to provide a title and description for your video, this can be done using the `data-title` and `data-description` attributes. - -```html - -``` - -Each format would be added to your sitemap in the following format: - -```xml - - https://archive.org/download/DuckAndCover_185/__ia_thumb.jpg - Duck and Cover - - This film, a combination of animated cartoon and live action, shows young children what to do in case of an atomic attack. - - - https://archive.org/download/DuckAndCover_185/CivilDefenseFilm-DuckAndCoverColdWarNuclearPropaganda_512kb.mp4 - - -``` diff --git a/docs/content/2.sitemap/2.guides/3.cache.md b/docs/content/2.sitemap/2.guides/3.cache.md deleted file mode 100644 index 158bb393..00000000 --- a/docs/content/2.sitemap/2.guides/3.cache.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: Sitemap Caching -description: Use the default cache engine to keep your sitemaps fast. ---- - -Caching your sitemap can help reduce the load on your server and improve performance. - -By default, SWR caching is enabled on production environments and sitemaps will be cached for 10 minutes. - -This is configured by overriding your route rules and leveraging the native Nuxt caching. - -### Cache Time - -You can change the cache time by setting the `cacheMaxAgeSeconds` option. - -```ts -export default defineNuxtConfig({ - sitemap: { - cacheMaxAgeSeconds: 3600 // 1 hour - } -}) -``` - -If you want to disable caching, set the `cacheMaxAgeSeconds` to `0`. - -### Cache Driver - -The cache engine is set to the Nitro default of the `cache/` path. - -If you want to customise the cache engine, you can set the `runtimeCacheStorage` option. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - sitemap: { - // cloudflare kv binding example - runtimeCacheStorage: { - driver: 'cloudflare-kv-binding', - binding: 'OG_IMAGE_CACHE' - } - } -}) -``` diff --git a/docs/content/2.sitemap/2.guides/4.route-rules.md b/docs/content/2.sitemap/2.guides/4.route-rules.md deleted file mode 100644 index cd2c2772..00000000 --- a/docs/content/2.sitemap/2.guides/4.route-rules.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: Route Rules -description: Configure your sitemap entries with route rules. ---- - -To change the behaviour of your sitemap URLs, you can use [Route rules](https://nuxt.com/docs/api/configuration/nuxt-config/#routerules). - -When doing so, you can provide either `robots: false` as a shortcut or a full `sitemap` object, see [Sitemap URL Schema](/sitemap/api/schema). - -Either through your nuxt config file using pattern matching. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - routeRules: { - // Don't add any /secret/** URLs to the sitemap.xml - '/secret/**': { robots: false }, - // modify the sitemap.xml entry for specific URLs - '/about': { sitemap: { changefreq: 'daily', priority: 0.3 } } - } -}) -``` - -Alternatively, you can use the `defineRouteRules` helper on specific pages. - -```vue [pages/index.vue] - -``` diff --git a/docs/content/2.sitemap/2.guides/5.prerendering.md b/docs/content/2.sitemap/2.guides/5.prerendering.md deleted file mode 100644 index 8fe5f3fb..00000000 --- a/docs/content/2.sitemap/2.guides/5.prerendering.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: Nuxt Prerendering -description: Perender your pages and have them all automatically added to your sitemap. ---- - -When prerendering routes using Nuxt through either `nuxi generate` or using the prerender options, the module -will extract data from the generated HTML and add it to the sitemap. - -This can be useful if you have dynamic routes that you want to be included in the sitemap and want to minimise -your configuration. - -## Extracted HTML Data - -The following data can be extracted from the raw HTML. - -- `images` - Adds image entries ``. - -Passes any `` tags within the `
` tag. Requires `discoverImages` to be enabled. - -- `lastmod` - Adds lastmod date ``. - -Uses the [opengraph](https://ogp.me) `article:modified_time` and `article:published_time` meta tag. - -## Enabling Nuxt Prerendering - -You will need to use configuration to enable this feature. - -```ts -export default defineNuxtConfig({ - nitro: { - prerender: { - // enabled by default with nuxt generate, not required - crawlLinks: true, - // add any routes to prerender - routes: ['/'] - } - } -}) -``` - -You can also use route rules to enable prerendering for specific routes. - -```ts -export default defineNuxtConfig({ - routeRules: { - '/': { prerender: true } - } -}) -``` - -### Prerendering the Sitemap on Build - -If you're using `nuxi build` and want to prerender the sitemap on build, you can add the sitemap path to the `nitro.prerender.routes` option. - -```ts -export default defineNuxtConfig({ - nitro: { - prerender: { - routes: ['/sitemap.xml'] - } - } -}) -``` diff --git a/docs/content/2.sitemap/2.guides/6.customising-ui.md b/docs/content/2.sitemap/2.guides/6.customising-ui.md deleted file mode 100644 index 2ef0b556..00000000 --- a/docs/content/2.sitemap/2.guides/6.customising-ui.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -title: Customising the UI -description: Change the look and feel of your sitemap. ---- - -## Disabling the XLS - -What you're looking at when you view the sitemap.xml is a XLS file, think of it just like you would a CSS file for HTML. - -To view the real sitemap.xml, you can view the source of the page. -If you prefer, you can disable the XLS by setting `xsl` to `false`. - -```ts -export default defineNuxtConfig({ - sitemap: { - xsl: false - } -}) -```` - -## Changing the columns - -You can change the columns that are displayed in the sitemap by modifying the `xslColumns` option. - -These have no effect on SEO and is purely for developer experience. - -Note: You must always have a `URL` column at the start. - -```ts -export default defineNuxtConfig({ - sitemap: { - xslColumns: [ - // URL column must always be set, no value needed - { label: 'URL', width: '75%' }, - { label: 'Last Modified', select: 'sitemap:lastmod', width: '25%' }, - ], - }, -}) -``` - -The `select` you provide is an XLS expression that will be evaluated against the sitemap entry. -It's recommended to prefix the value with `sitemap:` if in doubt. - -### Example: Adding priority and changefreq - -```ts -export default defineNuxtConfig({ - sitemap: { - xslColumns: [ - { label: 'URL', width: '50%' }, - { label: 'Last Modified', select: 'sitemap:lastmod', width: '25%' }, - { label: 'Priority', select: 'sitemap:priority', width: '12.5%' }, - { label: 'Change Frequency', select: 'sitemap:changefreq', width: '12.5%' }, - ], - }, -}) -``` - -### Example: Adding `hreflang` - -_Requires >= 3.3.2_ - -```ts -export default defineNuxtConfig({ - sitemap: { - xslColumns: [ - { label: 'URL', width: '50%' }, - { label: 'Last Modified', select: 'sitemap:lastmod', width: '25%' }, - { label: 'Hreflangs', select: 'count(xhtml:link)', width: '25%' }, - ], - }, -}) -``` - -## Disabling tips - -In development tips are displayed on the sitemap page to help you get started. - -You can disable these tips by setting the `xslTips` option to `false`. - -```ts -export default defineNuxtConfig({ - sitemap: { - xslTips: false, - }, -}) -``` diff --git a/docs/content/2.sitemap/2.guides/7.debugging.md b/docs/content/2.sitemap/2.guides/7.debugging.md deleted file mode 100644 index dc6bfe3d..00000000 --- a/docs/content/2.sitemap/2.guides/7.debugging.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: Debugging -description: How to debug the sitemap generated from Nuxt Sitemap. ---- - -It's quite likely at some point you'll open your sitemap and think "this isn't right". - -## Nuxt DevTools - -The best tool for debugging is the Nuxt DevTools integration with Nuxt Sitemap. - -This will show you all of your sitemaps and the sources used to generate it. - -## Debug Endpoint - -If you prefer looking at the raw data, you can use the debug endpoint. This is only enabled in -development unless you enable the `debug` option. - -Visit `/__sitemap__/debug.json` within your browser, this is the same data used by Nuxt DevTools. - -## Debugging Prerendering - -If you're trying to debug the prerendered sitemap, you should enable the `debug` option and check your output -for the file `.output/public/__sitemap__/debug.json`. diff --git a/docs/content/2.sitemap/2.guides/8.best-practices.md b/docs/content/2.sitemap/2.guides/8.best-practices.md deleted file mode 100644 index dd7b1e17..00000000 --- a/docs/content/2.sitemap/2.guides/8.best-practices.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: Sitemap.xml Best Practices -description: The best practices for generating a sitemap.xml file. -navigation: - title: Best Practices ---- - -## Performance - -When dealing with many URLs that are being generated from an external API, the best option is use the `sitemaps` -option to create [Named Sitemap Chunks](/sitemap/guides/multi-sitemaps). - -Each sitemap should contain its own `sources`, this allows other sitemaps to be generated without waiting for this request. - -```ts -export default defineNuxtConfig({ - sitemap: { - sitemaps: { - posts: { - sources: [ - 'https://api.something.com/urls' - ] - }, - }, - }, -}) -``` - -If you need to split this up further, you should consider chunking by the type and some pagination format. For example, -you can paginate by when posts were created. - -```ts -export default defineNuxtConfig({ - sitemap: { - sitemaps: { - posts2020: { - sources: [ - 'https://api.something.com/urls?filter[yearCreated]=2020' - ] - }, - posts2021: { - sources: [ - 'https://api.something.com/urls?filter[yearCreated]=2021' - ] - }, - }, - }, -}) -``` - -Additionally, you may want to consider the following experimental options that may help with performance: -- `experimentalCompression` - Gzip's and streams the sitemap -- `experimentalWarmUp` - Creates the sitemaps when Nitro starts - -## Set appropriate lastmod - -The `lastmod` field is used to indicate when a page was last updated. This is used by search engines to determine how often to crawl your site. - -This should not change based on code changes, only for updating the content. - -For example, if you have a blog post, the `lastmod` should be updated when the content of the blog post changes. - -It's recommended not to use `autoLastmod: true` as this will use the last time the page was built, which does -not always reflect content updates. - -Learn more https://developers.google.com/search/blog/2023/06/sitemaps-lastmod-ping - -## You probably don't need `changefreq` or `priority` - -These two fields are not used by search engines, and are only used by crawlers to determine how often to crawl your site. - -If you're trying to get your site crawled more often, you should use the `lastmod` field instead. - -Learn more https://developers.google.com/search/blog/2023/06/sitemaps-lastmod-ping diff --git a/docs/content/2.sitemap/2.guides/9.submitting-sitemap.md b/docs/content/2.sitemap/2.guides/9.submitting-sitemap.md deleted file mode 100644 index 4f66e0a7..00000000 --- a/docs/content/2.sitemap/2.guides/9.submitting-sitemap.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: 'Submitting Your Sitemap' -description: 'How to submit your sitemap to Google Search Console to start getting indexed.' ---- - -When going live with a new site and you're looking to get indexed by Google, the best starting point is -to submit your sitemap to Google Search Console. - -> Google Search Console is a free service offered by Google that helps you monitor, maintain, and troubleshoot -your site's presence in Google Search results. - -## Submitting Sitemap - -Google provides a guide on [Submitting your Sitemap to Google](https://developers.google.com/search/docs/crawling-indexing/sitemaps/build-sitemap) which is a great starting point. - -You should index either `/sitemap.xml` or if you're using multiple sitemaps, add `/sitemap_index.xml`. - -## Requesting Indexing - -It's important to know that submitting your sitemap does not guarantee that all your pages will be indexed and that it may take -some time for Google to crawl and index your pages. - -To speed up the process, you can use the [URL Inspection Tool](https://support.google.com/webmasters/answer/9012289) to request indexing of a specific URL. - -In some cases you may want to expedite the indexing process, for this, you can try out my free open-source tool [Request Indexing](https://requestindexing.com). - -## Sitemap Error - -When submitting a sitemap for the first time you may get see "Error". This is because Google previously -crawled your site for a sitemap and found nothing. - -When encountering this it's best to wait a few days and see if the error resolves itself. If not, you can -try resubmitting the sitemap or making a [GitHub Issue](https://github.com/nuxt-modules/sitemap). diff --git a/docs/content/2.sitemap/2.guides/_dir.yml b/docs/content/2.sitemap/2.guides/_dir.yml deleted file mode 100644 index e9454921..00000000 --- a/docs/content/2.sitemap/2.guides/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Guides diff --git a/docs/content/2.sitemap/4.api/0.config.md b/docs/content/2.sitemap/4.api/0.config.md deleted file mode 100644 index 46a46527..00000000 --- a/docs/content/2.sitemap/4.api/0.config.md +++ /dev/null @@ -1,223 +0,0 @@ ---- -title: Config -description: Configure the sitemap module. ---- - -## `enabled` - -- Type: `boolean` -- Default: `true` - -Whether to generate the sitemap. - -## `sortEntries` - -- Type: `boolean` -- Default: `true` - -Whether the sitemap entries should be sorted or be shown in the order they were added. - -When enabled the entries will be sorted by the `loc`, they will be sorted by the path segment -count and then alphabetically using `String.localeCompare` to ensure numbers are sorted correctly. - -## `sources` - -- Type: `SitemapSource[]` -- Default: `[]` - -The sources to use for the sitemap. See [Data Sources](/sitemap/getting-started/data-sources) and [Dynamic URL Endpoint](/sitemap/guides/dynamic-urls) for details. - -## `excludeAppSources` - -- Type: `boolean|AppSourceId[]` -- Default: `false` - -Whether to exclude [app sources](/sitemap/getting-started/data-sources) from the sitemap. - -## `appendSitemaps` - -- Type: `(string | { sitemap: string, lastmod?: Date })[]` -- Default: `false` - -Sitemaps to append to the sitemap index. - -This will only do anything when using multiple sitemaps. - -## `autoLastmod` - -- Type: `boolean` -- Default: `false` - -Whether to automatically detect the `lastmod` date for each URL. -If the `lastmod` date can't be inferred from a route page file it will use the current Date. - -## `sitemaps` - -- Type: `SitemapConfig[] | boolean` -- Default: `false` - -Whether to generate multiple sitemaps. - -See [Multi Sitemaps](/sitemap/guides/multi-sitemaps) for details. - -## `defaultSitemapsChunkSize` - -- Type: `number` -- Default: `1000` - -When using `sitemaps: true` this will be the default chunk size for each sitemap. - -## `defaults` - -- Type: `object` -- Default: `{}` - -Default values for the sitemap.xml entries. See [sitemaps.org](https://www.sitemaps.org/protocol.html) for all available options. - -## `urls` - -- Type: `() => MaybePromise | MaybePromise` -- Default: `[]` - -Provide custom URLs to be included in the sitemap.xml. - -## `include` - -- Type: `(string | RegExp)[]` -- Default: `['/**']` - -Filter routes that match the given rules. See the [Filtering URLs](/sitemap/guides/filtering-urls) guide for details. - -```ts -export default defineNuxtConfig({ - sitemap: { - include: [ - '/my-hidden-url' - ] - } -}) -``` - -## `exclude` - -- Type: `(string | RegExp)[]` -- Default: `undefined` - -Filter routes that match the given rules. See the [Filtering URLs](/sitemap/guides/filtering-urls) guide for details. - -```ts -export default defineNuxtConfig({ - sitemap: { - exclude: [ - '/my-secret-section/**' - ] - } -}) -``` - -## `xsl` - -- Type: `string | false` -- Default: `/__sitemap__/style.xsl` - -The path to the XSL stylesheet for the sitemap.xml. Set to `false` to disable. - -## `discoverImages` - -- Type: `boolean` -- Default: `true` - -Whether to discover images from routes when prerendering. - -## `autoI18n` - -- Type: `undefined | boolean | { locales: NormalisedLocales; defaultLocale: string; strategy: 'prefix' | 'prefix_except_default' | 'prefix_and_default' }` -- Default: `undefined` - -Automatically add alternative language prefixes for each entry with the given prefixes. Set to `false` to disable. - -When using the @nuxtjs/i18n module, this will automatically be set to the configured `locales` when left `undefined`. - -## `sitemapName` - -- Type: `string` -- Default: `sitemap.xml` - -Modify the name of the root sitemap. - -Note: This only works when you're not using the multiple `sitemaps` option. - -## `strictNuxtContentPaths` - -- Type: `boolean` -- Default: `false` - -Whether the paths within nuxt/content match their real paths. This is useful when you're using the `nuxt/content` module -without documentDriven mode. - -## `cacheMaxAgeSeconds` - -- Type: `number` -- Default: `60 * 10` - -The time in seconds to cache the sitemaps. - -## `runtimeCacheStorage` - -- Type: `boolean | (Record & { driver: string })` -- Default: `true` - -The storage engine to use for the cache. See [Caching](/sitemap/guides/cache) for details. - -## `xslColumns` - -- Type: ``({ label: string; width: `${string}%`; select?: string })[]`` -- Default: -```json -[ - { "label": "URL", "width": "50%" }, - { "label": "Images", "width": "25%", "select": "count(image:image)" }, - { "label": "Last Updated", "width": "25%", "select": "concat(substring(sitemap:lastmod,0,11),concat(' ', substring(sitemap:lastmod,12,5)),concat(' ', substring(sitemap:lastmod,20,6)))" } -] -``` - -The columns to display in the XSL stylesheet. - -## `xslTips` - -- Type: `boolean` -- Default: `true` - -Whether to include tips on how to use the sitemap in the XSL stylesheet. - -## `experimentalWarmUp` - -- Type: `boolean` -- Default: `false` - -Should the sitemaps be warmed up when Nitro starts. This can be useful for large sitemaps. - -## `experimentalCompression` - -- Type: `boolean` -- Default: `false` - -Should the sitemaps be compressed and streamed when the request accepts it. - -## `credits` - -- Type: `boolean` -- Default: `true` - -Whether to include a comment on the sitemaps on how it was generated. - -## `debug` - -- Type: `boolean` -- Default: `false` - -Enable to see debug logs and API endpoint. - -The route at `/__sitemap__/debug.json` will be available in non-production environments. - -See the [Debugging](/sitemap/guides/debugging) guide for details. diff --git a/docs/content/2.sitemap/4.api/_dir.yml b/docs/content/2.sitemap/4.api/_dir.yml deleted file mode 100644 index 91864357..00000000 --- a/docs/content/2.sitemap/4.api/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Nuxt API diff --git a/docs/content/2.sitemap/4.api/schema.md b/docs/content/2.sitemap/4.api/schema.md deleted file mode 100644 index b019baf5..00000000 --- a/docs/content/2.sitemap/4.api/schema.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -title: Schema -description: The schema for some of the sitemap module data. ---- - -## Sitemap Entry - -The sitemap entry schema mostly follows the [sitemap specification](https://www.sitemaps.org/protocol.html), with additional Sitemap extension recommendations from Google such as [News](https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap), [Images](https://developers.google.com/search/docs/crawling-indexing/sitemaps/image-sitemaps), and [Videos](https://developers.google.com/search/docs/crawling-indexing/sitemaps/video-sitemaps). - -The following options are supported: - -- `loc` - URL of the page. -- `lastmod` - The date of last modification of the file -- `changefreq` - How frequently the page is likely to change. -- `priority` - The priority of this URL relative to other URLs on your site. -- `alternatives` - An array of alternatives to include in the sitemap entry as ``. -- `news` - An array of news to include in the sitemap entry as ``. -- `images` - An array of images to include in the sitemap entry as ``. -- `video` - An array of videos to include in the sitemap entry as ``. - -```ts -export interface SitemapUrl { - loc: string - lastmod?: string | Date - changefreq?: Changefreq - priority?: 0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1 - alternatives?: Array - news?: GoogleNewsEntry - images?: Array - videos?: Array - _i18nTransform?: boolean - _sitemap?: string - url?: string // @deprecated use `loc` -} - -export type Changefreq = - | 'always' - | 'hourly' - | 'daily' - | 'weekly' - | 'monthly' - | 'yearly' - | 'never' - -export interface AlternativeEntry { - hreflang: string - href: string | URL -} - -export interface GoogleNewsEntry { - title: string - publication_date: Date | string - publication: { - name: string - language: string - } -} - -export interface ImageEntry { - loc: string | URL - caption?: string - geoLocation?: string - title?: string - license?: string | URL -} - -export interface VideoEntry { - title: string - thumbnail_loc: string | URL - description: string - content_loc?: string | URL - player_loc?: string | URL - duration?: number - expiration_date?: Date | string - rating?: number - view_count?: number - publication_date?: Date | string - family_friendly?: 'yes' | 'no' | boolean - restriction?: Restriction - platform?: Platform - price?: ({ - price?: number | string - currency?: string - type?: 'rent' | 'purchase' | 'package' | 'subscription' - })[] - requires_subscription?: 'yes' | 'no' | boolean - uploader?: { - uploader: string - info?: string | URL - } - live?: 'yes' | 'no' | boolean - tag?: string | string[] -} -``` diff --git a/docs/content/2.sitemap/5.nitro-api/_dir.yml b/docs/content/2.sitemap/5.nitro-api/_dir.yml deleted file mode 100644 index dd231477..00000000 --- a/docs/content/2.sitemap/5.nitro-api/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Nitro API diff --git a/docs/content/2.sitemap/5.nitro-api/nitro-hooks.md b/docs/content/2.sitemap/5.nitro-api/nitro-hooks.md deleted file mode 100644 index 15f82e64..00000000 --- a/docs/content/2.sitemap/5.nitro-api/nitro-hooks.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -title: Nitro Hooks -description: Learn how to use Nitro Hooks to customize your sitemap entries. ---- - -Nitro hooks can be added to modify the output of your sitemaps at runtime. - -## `sitemap:resolved` - -**Type:** `async (ctx: { urls: SitemapConfig; sitemapName: string }) => void | Promise` - -Triggered once the final structure of the XML is generated, provides the URLs as objects. - -```ts [server/plugins/sitemap.ts] -import { defineNitroPlugin } from 'nitropack/runtime/plugin' - -export default defineNitroPlugin((nitroApp) => { - nitroApp.hooks.hook('sitemap:resolved', async (ctx) => { - // single sitemap example - just add the url directly - ctx.urls.push({ - loc: '/my-secret-url', - changefreq: 'daily', - priority: 0.8, - }) - // multi sitemap example - filter for a sitemap name - if (ctx.sitemapName === 'posts') { - ctx.urls.push({ - loc: '/posts/my-post', - changefreq: 'daily', - priority: 0.8, - }) - } - }) -}) -``` - -## `sitemap:index-resolved` - -**Type:** `async (ctx: { sitemaps: { sitemap: string, lastmod?: string }[] }) => void | Promise` - -Triggered once the final structure of the sitemap index is generated, provides the sitemaps as objects. - -```ts [server/plugins/sitemap.ts] -import { defineNitroPlugin } from 'nitropack/runtime/plugin' - -export default defineNitroPlugin((nitroApp) => { - nitroApp.hooks.hook('sitemap:index-resolved', async (ctx) => { - // add a new sitemap to the index - ctx.sitemaps.push({ - sitemap: 'https://mysite.com/my-sitemap.xml', - lastmod: new Date().toISOString(), - }) - }) -}) -``` - -## `sitemap:output` - -**Type:** `async (ctx: { sitemap: string; sitemapName: string }) => void | Promise` - -Triggered before the sitemap is sent to the client. -It provides the sitemap as a XML string. - -```ts [server/plugins/sitemap.ts] -import { defineNitroPlugin } from 'nitropack/runtime/plugin' - -export default defineNitroPlugin((nitroApp) => { - nitroApp.hooks.hook('sitemap:output', async (ctx) => { - // append a comment credit to the footer of the xml - ctx.sitemap = `${ctx.sitemap}\n` - }) -}) -``` - -## Recipes - -### Modify Sitemap `xmlns` attribute - -For some search engines, you may need to add a custom `xmlns` attribute to the sitemap. You can do this with a simple -search and replace in the `sitemap:output` hook. - -```ts [server/plugins/sitemap.ts] -import { defineNitroPlugin } from 'nitropack/runtime/plugin' - -export default defineNitroPlugin((nitroApp) => { - nitroApp.hooks.hook('sitemap:output', async (ctx) => { - ctx.sitemap = ctx.sitemap.replace(' void | Promise` - -This will let you modify the string content of the final sitemap before it is returned from the server. - -Can be ran in both Nitro (runtime) and Nuxt (prerendering). - -## New Hook: `sitemap:resolved` - -**Type:** `async (ctx: { sitemap: FullSitemapEntry[]; sitemapName: string }) => void | Promise` - -This will let you modify the final sitemap before it is turned into a string. - -Can be ran in both Nitro (runtime) and Nuxt (prerendering). - -### Individual multi-sitemap API endpoints `dynamicUrlsApiEndpoint` - -- Type: `boolean | string` -- Default: `false` - -You can now give each sitemap a unique API endpoint to fetch URLs from. - -```ts -export default defineNuxtConfig({ - sitemap: { - sitemaps: { - foo: { - dynamicUrlsApiEndpoint: '/api/foo-sitemap' - }, - bar: { - dynamicUrlsApiEndpoint: '/api/bar-sitemap' - }, - }, - } -}) -``` - -### New Config: `strictNuxtContentPaths` - -- Type: `boolean` -- Default: `false` - -Enable when the paths of your nuxt/content md files match the routing. - -This will automatically add sitemap content to the sitemap. - -This is similar behaviour to using `nuxt/content` with `documentDriven: true`. - -### New Config: `credits` - -- Type: `boolean` -- Default: `true` - -Allows you to remove the "Generate by Nuxt Sitemap" comment from the generated sitemap. - -### New Config: `xslTips` - -- Type: `boolean` -- Default: `true` - -Toggle the tips displayed on the sitemap.xml pages. - -## Deprecation - -- `trailingSlash` has been deprecated -- `siteUrl` has been deprecated -- `autoAlternativeLangPrefixes` is now disabled by default. If you want to enable it, you need to set it to `true` explicitly. diff --git a/docs/content/2.sitemap/5.releases/v4.md b/docs/content/2.sitemap/5.releases/v4.md deleted file mode 100644 index ef0b104f..00000000 --- a/docs/content/2.sitemap/5.releases/v4.md +++ /dev/null @@ -1,126 +0,0 @@ ---- -navigation: - title: v4.0.0 -title: Nuxt Sitemap v4.0.0 -description: Release notes for v4.0.0 of Nuxt Sitemap. ---- - -## Background - -Over the last couple of months I've had many issues reported with similar themes: -- Dynamic URLs are hard to work with -- It's difficult to get multiple sitemaps to show the correct URLs -- I18n has many small issues - -I hope this release can resolve these. It has required replacing much of the underlying logic, please test your sitemaps after upgrading. - -## Features :rocket: - -### 🥫 Sitemap Sources - -The v4 introduces the official concept of 'sources' to your sitemaps. - -Every URL within your sitemap will belong to a source. A source will either be a User source or a Application source. - -This concept existed before v4 in different forms, v4 aims to clean them up and make working with them much easier. - -For full documentation see [Sitemap Sources](/sitemap/getting-started/data-sources). - -### 🤝 Nuxt Dev Tools Integration - -Nuxt Sitemap now has a dedicated tab in Nuxt Dev Tools to help you debug. - -
- - - nuxt-simple-sitemap-devtools.webm - - - - -
- -### 💬 More i18n Improvements - -- Locale domain support ([#155](https://github.com/nuxt-modules/sitemap/issues/155)) -- Support pages opt-outed using `defineI18nRoute(false)` ([#126](https://github.com/nuxt-modules/sitemap/issues/126)) -- Only add trusted i18n routes, will use meta tags when prerendering -- Less aggressive filtering -- Opt-in to transform dynamic URLs `__i18nTransform: true` - -See the updated [i18n documentation](/sitemap/integrations/i18n) - -### 🚀 Caching Improvements - -Now utilises native route rules. By default will set up SWR rules for 10 minutes. - -Learn more on the [Sitemap Caching](/sitemap/guides/cache) guide. - -## Other Improvements - -### Nitro Composables for better types - -When creating an API endpoint that returns URLs you should use the new `defineSitemapEventHandler` function for full TypeScript support. - -```ts -// api/sitemap.ts -export default defineSitemapEventHandler(() => { - return ['/foo'] -}) -``` - -### Prerendering Improvements - -Previously prerendering was done in a Node context, this will now run in a Nitro context which will provide better consistency between prerender and runtime environments. - -### Video Support - -Video entries are now supported properly. ([#159](https://github.com/nuxt-modules/sitemap/issues/159)) - -## ⚠️ Deprecations - -- `cacheTtl` is deprecated, you should use `cacheMaxAgeSeconds` which is more explicit. -- `inferStaticPagesAsRoutes` is deprecated, if you were using this to opt-out of pages, you should use `excludeAppSources: true` - -## ☠️ Breaking Changes - -### Nuxt Hooks no longer supported - -If you were using Nuxt hooks to modify the prerendered sitemap, you will need to migrate these to Nitro hooks. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - hooks: { - // old - no longer supported - 'sitemap:resolved': function (ctx) {}, - 'sitemap:output': function (ctx) {} - }, -}) -``` - -```ts [server/plugins/sitemap] -export default defineNitroPlugin((nitroApp) => { - nitroApp.hooks.hook('sitemap:output', async (ctx) => { - // supported! - }) -}) -``` - -### Multi Sitemap App Sources - -By default, app sources will no longer be included in multi sitemap implementations. You will need to use `includeAppSources: true` to re-enable it. See [Extending App Sources](/sitemap/guides/multi-sitemaps#extending-app-sources) for more information. - -### Removed deprecations - -- The hook `sitemap:prerender` has been removed. You should use `sitemap:resolved` instead. -- The config `trailingSlash` and `siteUrl` has been removed. You should use site config, see [Setting Site Config](/site-config/guides/setting-site-config). -- The config `autoAlternativeLangPrefixes` has been removed. If you'd like to set up automatic alternative language prefixes use `__i18nTransform`. - -## Support my work - -This release took over 40 hours. -If technical SEO developer experience in Nuxt is important to you, consider [supporting my work](https://github.com/sponsors/harlan-zw) on [Nuxt SEO](https://nuxtseo.com). diff --git a/docs/content/2.sitemap/5.releases/v5.md b/docs/content/2.sitemap/5.releases/v5.md deleted file mode 100644 index 5d075e47..00000000 --- a/docs/content/2.sitemap/5.releases/v5.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -navigation: - title: v5.0.0 -title: Nuxt Sitemap v5.0.0 -description: Release notes for v5.0.0 of Nuxt Sitemap. ---- - -## 🚨 Breaking Changes - -### Package Renamed to `@nuxtjs/sitemap` - -This module is now the official Sitemap module for Nuxt. To properly -reflect this, the package has been renamed to `@nuxtjs/sitemap` from `nuxt-simple-sitemap` and -the GitHub repository has been moved to [nuxt-modules/sitemap](https://github.com/nuxt-modules/sitemap). - -1. Update the dependency - -```diff -{ - "dependencies": { -- "nuxt-simple-sitemap": "*" -+ "@nuxtjs/sitemap": "^5.0.0" - } -} -``` - -2. Update your `nuxt.config`. - -```diff -export default defineNuxtConfig({ - modules: [ -- 'nuxt-simple-sitemap' -+ '@nuxtjs/sitemap' - ] -}) -``` - -## Features :rocket: - -##    🐞 Bug Fixes - -### Improved Cache Debugging - -- Set browser cache time to match `cacheMaxAgeSeconds`  -  by @harlan-zw [(00d17)](https://github.com/nuxt-modules/sitemap/commit/00d176e) -- Iso timestamp for debugging cache  -  by @harlan-zw [(db3f3)](https://github.com/nuxt-modules/sitemap/commit/db3f337) -- Cache headers for prerendered sitemap  -  by @harlan-zw [(57bef)](https://github.com/nuxt-modules/sitemap/commit/57bef21) -- More explicit caching  -  by @harlan-zw [(328b7)](https://github.com/nuxt-modules/sitemap/commit/328b737) - -### More Consistent DevTools UI - -The DevTools has been updated to match the branding of the other Nuxt SEO module DevTools. [(bc4ae)](https://github.com/nuxt-modules/sitemap/commit/bc4aebc) - -### Others - -- Redirect multi sitemap `sitemap.xml` using route rules  -  by @harlan-zw [(e1bee)](https://github.com/nuxt-modules/sitemap/commit/e1bee81) - -#####     [View changes on GitHub](https://github.com/nuxt-modules/sitemap/compare/v4.4.1...v5.0.0) diff --git a/docs/content/2.sitemap/5.releases/v6.md b/docs/content/2.sitemap/5.releases/v6.md deleted file mode 100644 index c6c6cfa2..00000000 --- a/docs/content/2.sitemap/5.releases/v6.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -navigation: - title: v6.0.0 -title: Nuxt Sitemap v6.0.0 -description: Release notes for v6.0.0 of Nuxt Sitemap. ---- - -## Introduction - -The v6 represents hopefully the last major that the module will undergo. It brings many underlying -logic improvements which aim to solve stability and performance issues and set up the module to support -chunked multi-sitemaps in the future. - -## 🚨 Breaking Change - -### Google Search Console - -If you're using multi-sitemaps it's important to check Google Search Console after the update and verify you haven't submitted the old multi-sitemap paths. If so, you should update them - -### Sitemap Output - -Please verify your sitemap output after the update. Many changes have been made to the underlying logic and it's important to verify that your sitemap is still being generated correctly. - -## Changelog - -###    🚨 Breaking Changes - -- Rewrite i18n resolving and url normalizing  -  by @harlan-zw in https://github.com/nuxt-modules/sitemap/issues/319 [(fab7e)](https://github.com/nuxt-modules/sitemap/commit/fab7e9e) -- New multi sitemaps paths  -  by @harlan-zw in https://github.com/nuxt-modules/sitemap/issues/320 [(bb7d9)](https://github.com/nuxt-modules/sitemap/commit/bb7d9c7) - -###    🚀 Features - -- `sitemapsPathPrefix` config  -  by @harlan-zw in https://github.com/nuxt-modules/sitemap/issues/325 [(4b94c)](https://github.com/nuxt-modules/sitemap/commit/4b94c3d) -- Add minify xml option  -  by @Henvy-Mango in https://github.com/nuxt-modules/sitemap/issues/336 [(f9197)](https://github.com/nuxt-modules/sitemap/commit/f919726) -- **i18n**: Support Nuxt I18n v9  -  by @harlan-zw in https://github.com/nuxt-modules/sitemap/issues/351 [(92d96)](https://github.com/nuxt-modules/sitemap/commit/92d9610) - -###    🐞 Bug Fixes - -- Better filtering of file URLs  -  by @harlan-zw [(27a95)](https://github.com/nuxt-modules/sitemap/commit/27a95be) -- Check for `robots` route rules  -  by @harlan-zw in https://github.com/nuxt-modules/sitemap/issues/321 [(ae455)](https://github.com/nuxt-modules/sitemap/commit/ae455da) -- Map `include`, `exclude` to i18n pages  -  by @harlan-zw in https://github.com/nuxt-modules/sitemap/issues/322 [(a7c04)](https://github.com/nuxt-modules/sitemap/commit/a7c04bc) -- Fallback to prerender sitemap on vercel edge  -  by @harlan-zw [(33598)](https://github.com/nuxt-modules/sitemap/commit/33598c8) -- Support `SERVER_PRESET` to detect env  -  by @harlan-zw [(295c9)](https://github.com/nuxt-modules/sitemap/commit/295c98f) -- Handle null `loc`'s  -  by @harlan-zw [(c0666)](https://github.com/nuxt-modules/sitemap/commit/c066610) -- `useNitroApp` import warning  -  by @harlan-zw [(f5ab8)](https://github.com/nuxt-modules/sitemap/commit/f5ab878) -- Preset not being resolved when using `--target`  -  by @harlan-zw [(2f6bc)](https://github.com/nuxt-modules/sitemap/commit/2f6bca8) -- Broken regex for `` components  -  by @harlan-zw [(469e7)](https://github.com/nuxt-modules/sitemap/commit/469e7bd) -- Ensure `loc` is always a string  -  by @harlan-zw [(de9ec)](https://github.com/nuxt-modules/sitemap/commit/de9ecc2) -- Improve entry `loc` normalizing  -  by @harlan-zw in https://github.com/nuxt-modules/sitemap/issues/354 [(6ef8d)](https://github.com/nuxt-modules/sitemap/commit/6ef8dcd) -- **i18n**: - - Support excluded locales  -  by @Xenossolitarius and **ipesic** in https://github.com/nuxt-modules/sitemap/issues/331 [(f9ba0)](https://github.com/nuxt-modules/sitemap/commit/f9ba056) - - Reverse only locales logic  -  by @Xenossolitarius and **ipesic** in https://github.com/nuxt-modules/sitemap/issues/346 [(cc86a)](https://github.com/nuxt-modules/sitemap/commit/cc86a0c) - - Broken trailing slashes config when using `differentDomains`  -  by @harlan-zw [(e8799)](https://github.com/nuxt-modules/sitemap/commit/e879913) - - Broken dedupe of loc and alternatives  -  by @harlan-zw in https://github.com/nuxt-modules/sitemap/issues/352 [(2b164)](https://github.com/nuxt-modules/sitemap/commit/2b16423) -- **module**: - - Prevent false positive warning about ignored root keys  -  by @madebyfabian in https://github.com/nuxt-modules/sitemap/issues/338 [(e4543)](https://github.com/nuxt-modules/sitemap/commit/e45432b) -- **prerendering**: - - Prefer runtime site url validation  -  by @harlan-zw [(779d1)](https://github.com/nuxt-modules/sitemap/commit/779d100) - -#####     [View changes on GitHub](https://github.com/nuxt-modules/sitemap/compare/v5.3.5...v6.0.0) diff --git a/docs/content/2.sitemap/_dir.yml b/docs/content/2.sitemap/_dir.yml deleted file mode 100644 index 27a503ac..00000000 --- a/docs/content/2.sitemap/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: OG Image diff --git a/docs/content/0.nuxt-seo/3.api/4.breadcrumbs.md b/docs/content/3.api/4.breadcrumbs.md similarity index 100% rename from docs/content/0.nuxt-seo/3.api/4.breadcrumbs.md rename to docs/content/3.api/4.breadcrumbs.md diff --git a/docs/content/0.nuxt-seo/3.api/9.config.md b/docs/content/3.api/9.config.md similarity index 100% rename from docs/content/0.nuxt-seo/3.api/9.config.md rename to docs/content/3.api/9.config.md diff --git a/docs/content/0.nuxt-seo/3.api/_breadcrumb-nuxt-ui.md b/docs/content/3.api/_breadcrumb-nuxt-ui.md similarity index 100% rename from docs/content/0.nuxt-seo/3.api/_breadcrumb-nuxt-ui.md rename to docs/content/3.api/_breadcrumb-nuxt-ui.md diff --git a/docs/content/0.nuxt-seo/3.api/_breadcrumb-raw.md b/docs/content/3.api/_breadcrumb-raw.md similarity index 100% rename from docs/content/0.nuxt-seo/3.api/_breadcrumb-raw.md rename to docs/content/3.api/_breadcrumb-raw.md diff --git a/docs/content/0.nuxt-seo/3.api/_dir.yml b/docs/content/3.api/_dir.yml similarity index 100% rename from docs/content/0.nuxt-seo/3.api/_dir.yml rename to docs/content/3.api/_dir.yml diff --git a/docs/content/3.og-image/0.getting-started/1.installation.md b/docs/content/3.og-image/0.getting-started/1.installation.md deleted file mode 100644 index 885340ca..00000000 --- a/docs/content/3.og-image/0.getting-started/1.installation.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: 'Install Nuxt OG Image' -description: 'Get started with Nuxt OG Image by installing the dependency to your project.' -navigation: - title: 'Installation' ---- - -Using [Nuxt SEO](/nuxt-seo/getting-started/installation)? This module is already installed for you. - -1. Install the `nuxt-og-image` dependency to your project: - -```bash -npx nuxi@latest module add og-image -``` - -2. Set a Site URL - -To prerender pages that use OG Image, the module needs to know your site URL. - -The easiest way to set a site URL is to provide it in your `nuxt.config`: - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - site: { - // production URL - url: 'https://example.com', - }, -}) -``` - -Otherwise, you can use an `.env` file or environment variables. - -```bash [.env] -NUXT_PUBLIC_SITE_URL=https://example.com -``` - -For more complex applications, learn more at the [Nuxt Site Config docs](/site-config/getting-started/how-it-works). - -3. Enable Nuxt DevTools - -Nuxt OG Image uses [Nuxt DevTools](https://devtools.nuxt.com/) to provide a live preview of your OG Images. - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - devtools: { enabled: true }, -}) -``` - -4. Create your first image - -Setup complete! Now get started with [your first image](/og-image/getting-started/getting-familar-with-nuxt-og-image). diff --git a/docs/content/3.og-image/0.getting-started/3.stackblitz.md b/docs/content/3.og-image/0.getting-started/3.stackblitz.md deleted file mode 100644 index 8155ff90..00000000 --- a/docs/content/3.og-image/0.getting-started/3.stackblitz.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: "Reproductions: Stackblitz" -description: Create minimal reproductions for Nuxt OG Image or just experiment with the module. ---- - -You can use the following Stackblitz playgrounds to experiment with Nuxt OG Image. - -If you run into any issues with Nuxt OG Image, it's recommended to clone of these playgrounds Stackblitz -to reproduce the issue. - -## Stackblitz Playgrounds - -- [StackBlitz - Minimal Playground Example](https://stackblitz.com/edit/nuxt-starter-pxs3wk?file=pages/index.vue) -- [StackBlitz - Alpine Theme](https://stackblitz.com/edit/github-hgunsf?file=package.json) - -## Stackblitz Compatibility - -StackBlitz runs Nuxt within a webcontainer, so it has fairly limited compatibility. - -- You can't use anything that will require a fetch request to a different server (e.g. Google Fonts, custom Emojis, images, etc). -- The `chromium` renderer is not supported -- `sharp` is not supported, so you can't use JPEGs -- `inline-css` is not supported, so you can't ` -``` - -For this to work, it will inline any styles, so they can be supported by the Satori parser. - -### Custom Font Support - -You can now use any font that you want in your images with a simple config. - -```ts -export default defineOgImage({ - ogImage: { - fonts: [ - 'Inter:400', // loads from google - { - name: 'optieinstein', - weight: 800, - path: '/OPTIEinstein-Black.otf', // loads locally - } - ], - } -}) -``` - -You can learn more on the [Custom Fonts](/og-image/guides/custom-fonts) page. - -### Playground: Editable Props - -The playground now supports editing the props of the image. This is useful for testing out different configurations. - -OG Image editing - -### Nuxt Icon Support - -You can now use [Nuxt Icons](https://github.com/nuxt-modules/icon) in your images. - -```vue - -``` - -### New Component Folder - -The new recommendation for components is to put them inside the `OgImage` folder. - -Any components in this folder will be configured to be a Nuxt Island. You can extend the folders by using the `componentDirs` option if you prefer your own convention. Setting up components in this dir will also allow you to reference the component using a shorthand instead of the full path. - -For example, a component at `./components/OgImage/Foo.vue` can be referenced as: - -```ts -defineOgImage({ - component: 'Foo' // foo, OgImageFoo and og-image-foo will also work -}) -``` - -Otherwise, any island components set up with the previous convention will still work. - -### New composable / component API - -A cleaner, simpler API for defining your og images. - -```ts -defineOgImage(options) -``` - -```vue - -``` - -The old API is deprecated but will still work. - -### Runtime Cache - -Server-Side rendered images will now be cached by default. This will speed up the time to first byte for your images -and reduce the load on your server. - -See the [Cache](/og-image/guides/cache) page for more details. - -### Nuxt Site Config - -The `siteUrl` config was required for prerendering the og:image to an absolute path, this is now deprecated. - -Instead, [nuxt-site-config](https://github.com/harlan-zw/nuxt-site-config) is used which automatically sets the URL -for some environments. - -See the [Prerendering Images](/og-image/guides/prerendering-images) page for more details. - -## Deprecations and Breaking Changes - -### API Changes - -The following options have been removed from nuxt.config: - -- `host`, `siteUrl` - see [prerendering-images](/og-image/guides/prerendering-images) for details. -- `forcePrerender` - removed, not needed -- `satoriProvider` - removed use `runtimeSatori` -- `browserProvider` - removed use `runtimeBrowser` -- `experimentalInlineWasm` - removed, this is now automatic based on environment -- `experimentalRuntimeBrowser` - removed, this is now automatic based on environment - -The following options have been deprecated from the `defineOgImage` options: - -- `static` - use `cache` instead - -If you were referencing the old default template, you will need to update it. - -- `OgImageBasic` - remove the property, allow the fallback to be selected automatically - -Composables & Components: - -- `defineOgImageStatic()` is deprecated, use `defineOgImage()` (default behaviour is to cache), if you want to be verbose you can use `defineOgImageCached()` or `` -- `` is deprecated, use `` -- `defineOgImageDynamic()` is deprecated, use `defineOgImageWithoutCache()` -- `` is deprecated, use `` - -### Behaviour Changes - -If you were using the runtime browser previously, you will need to manually opt-in for it to work in production. - -```ts -export default defineNuxtConfig({ - ogImage: { - runtimeBrowser: true - } -}) -``` diff --git a/docs/content/3.og-image/7.releases/v3.md b/docs/content/3.og-image/7.releases/v3.md deleted file mode 100644 index 93538113..00000000 --- a/docs/content/3.og-image/7.releases/v3.md +++ /dev/null @@ -1,381 +0,0 @@ ---- -title: v3.0.0 -description: Release notes for Nuxt OG Image v3. -path: /og-image/releases/v3 -publishedOn: 2023-12-11 -ogImage: - component: Release - props: - colorScheme: dark - title: The v3 Release is here! - description: Nuxt OG Image v3 is here, and it's a complete rewrite of the module to improve stability and DX. I think you're going to love it! ---- - -## Background - -I'm excited to share the v3 of Nuxt OG Image is here, featuring a complete rewrite of the module to improve stability and developer -experience. - -Nuxt OG Image was and remains to be possible due to many experimental Nuxt / Nitro features as -well as bespoke hacks: - -- Nuxt Islands -- Nitro WASM support -- Binary data with Unstorage and serving it with H3 -- Customising Nitro prerenderer - -In rewriting the module, I wanted to opt-in to newer more stable ways of doing things, or send upstream PRs so -I wouldn't need to rely on hacks. - -I couldn't help myself improving the developer experience as I went. - -## 💚 Support my work - -This has taken me 90 hours to complete. -If amazing SEO DX for Nuxt is important to you, consider [supporting my work](https://github.com/sponsors/harlan-zw) on [Nuxt SEO](/). - -Thank you to all my existing sponsors. - -## 🚀 Features - -### ⛹️ Play Time: New Playground - -The playground has been redesigned with a focus on giving you more ways to preview and debug your templates. It introduces -a number of tabs: - -- **Design** - -The default design view, this is the similar to v2 playground. It gives you HMR of the template, the ability -to change the options used to render the template. - -New features include a social media previews (Twitter, Slack), changing -the rendering (Chromium, Satori) and more. - -::tab-comparison - -:Image{class="m-0" loading="lazy" src="https://github.com/harlan-zw/nuxt-og-image/assets/5326365/e337b490-dccb-4e58-972a-5e6e63f30986" label="v3" alt="v3 preview of OG Image"} -:Image{class="m-0" loading="lazy" src="https://repository-images.githubusercontent.com/578125755/90f77ca8-95be-4e06-9600-332afe1ba24f" label="v2" alt="v2 preview of OG Image"} - -:: - -- **Templates** - -See and preview all the OG templates available to you. You can select a template -to switch to it. - -This also introduces "Community Templates", which are templates designed by the community, accessible to you. There are -7 community templates so far and more to come. Feel free to submit your own! - -:Image{loading="lazy" src="https://github.com/harlan-zw/nuxt-og-image/assets/5326365/ab0f8d86-3167-4369-af2b-dfa4153a08ea" alt="v3 gallery tab"} - -- **Debug** - -See the raw input and output of the template. This is useful for debugging your templates. Will be expanded in the future. - -- **Docs** - -An iframe of the module documentation. - -### 🇹 Type Safety with `defineOgImageComponent` - -In v2, you had to define your config using `defineOgImage`. This was okay but the API provided minimal type safety. - -In v3, you can now define your config using `defineOgImageComponent` which provides type safety by reading the type definitions from the -component you're using. - -```ts -defineOgImageComponent( - // component name - 'NuxtSeo', - // component props - { title: 'Hello!' }, - // image options - { alt: 'A welcome message' } -) -``` - -### 🍃 UnoCSS and Theming Support - -Satori itself provides a subset of Tailwind CSS classes that you can use to style your templates. This is great but also -limited. - -With v3, the module now runs UnoCSS's [preset-wind](https://unocss.dev/presets/wind), loaded with your Tailwind / UnoCSS theme config, before Satori. - -```ts -export default defineConfig({ - theme: { - fontSize: { - 'mega-big': '100px', - }, - colors: { - base: colors.white, - primary: colors.green, - }, - }, -}) -``` - -UnoCSS will convert any classes you use into inlined CSS for the `style` attribute. While this won't provide complete -compatibility with Tailwind, it gives you access to a lot more classes than Satori alone. - -```vue - -``` - -### 😁 More Emojis - -In v2 we were limited to only `twemoji` emojis (Twitter Emojis). - -In v3 we switch to using the [Iconify API](https://iconify.design/docs/api/) which gives us access to the following emoji families: -`twemoji`, `noto`, `fluent-emoji`, `fluent-emoji-flat`, `fluent-emoji-high-contrast`, `noto-v1`, `emojione`, `emojione-monotone`, `emojione-v1`, `streamline-emojis`, `openmoji` - -The default emoji family has been switched to `noto`, providing a more complete set of emojis and -looks better generally. - -### 🖼️ JPEG OG Images - -PNGs are great for most use cases, but they come at the cost of a larger file size. - -For Chromium based rendering, `jpeg` images will now be rendered by default. - -For Satori, you can now opt-in by adding a `sharp` dependency and switching the extension to `jpeg`. - -See the [JPEGs](/og-image/guides/jpegs) guide for more information. - -### 📝 Nuxt Content integration - -Using a component or composable with within your markdown content is a bit awkward. - -With v3 the module now supports the `ogImage` frontmatter key that can be used to configure your OG Image. -This will only work when you're using Document Driven mode, or you have set a `path`. - -```md [content/blog/3-months-of-europe.md] ---- -path: /blog/3-months-of-europe -ogImage: - component: BlogOgImage - props: - image: /blog/3-months-of-europe.png - readingMins: 5 ---- -``` - -### 🔄 OG Image Route Rule - -In some cases, you'll want to apply OG Image settings for a subset of pages. -With the new route rule support, you can now handle this even easier. - -This lets you provide a `ogImage` key that will be either used or merged into the existing OG Image options. - -For example, this documentation website uses it to set the `icon` depending on your path. - -```ts -export default defineNuxtConfig({ - routeRules: { - '/og-image/**': { - ogImage: { - props: { icon: 'carbon:image-search' } - } - } - } -}) -``` - -### Improved `css-inline` Compatibility - -Whenever you add a template has a ` -``` - -## ✨ Improvements - -### New OG Image URL - -The old pattern for OG images was `//__og_image__/og.png`, this has been changed to `/__og-image__/image//og.`. - -With this change, the route is no longer added as a middleware, meaning you can hook into the route yourself. - -It also means it's easier to target using route rules if you want to make adjustments. - -### New OG Image Size - -In v2 we render OG Images at 1200x630 (1:19), this was the recommended resolution from Facebook. - -For better compatibility with other Social platforms, we now use 1200x600 (1:2). This particular will render OG Images better on WhatsApp. - -### Per-Template Custom Fonts - -Sometimes you'll be rendering a custom template that you want to use a custom font with, without -having to load that font for all templates. - -Now you can using `fonts` prop on the `defineOgImage` component. - -```ts -defineOgImage({ - fonts: [ - 'Noto+Sans:400' - ] -}) -``` - -See the [Custom Fonts](/og-image/guides/custom-fonts) guide for more details. - -### Updated Default Template - -The default template is now called `NuxtSeo`. -It now uses a more modern design, with a focus on readability. - -It introduces a number of new props: -- `colorMode` - `light`, `dark` - -Changes from a light or dark background / text color. Integrates with `@nuxtjs/color-mode`, selecting your -default color mode. - -- `theme` - `#${string}` - -Change the hex color of the flare and the Nuxt SEO logo. - -::tab-comparison - -:Image{src="/__og-image__/image/og-image/releases/v3/og.png?component=NuxtSeo&colorMode=light" label="Light mode" alt="v3 light mode"} -:Image{src="/__og-image__/image/og-image/releases/v3/og.png?component=NuxtSeo&colorMode=dark" label="Dark mode" alt="v3 dark mode"} -:Image{src="/__og-image__/image/og-image/releases/v3/og.png?component=NuxtSeo&theme=%23d946ef&siteName=Purple&icon=carbon%3Afire" label="Theming" alt="v3 dark mode"} - -:: - -Learn more on the [NuxtSeo Template](/og-image/api/nuxt-seo-template) docs. - -### Stale-While-Revalidate Caching - -When generating images at runtime, it's important that we cache them to reduce the load on your server. - -While caching for v2 worked, it was a bit of a mess with many configuration options. - -In v3, the caching has been simplified to a single prop called `cacheMaxAgeSeconds` that by default, is set to -`259200` (72 hours). - -While not recommended, you can disable the caching by providing `cacheMaxAgeSeconds: 0`. You should instead opt -for a lower cache time `cacheMaxAgeSeconds: 300` (5 minutes). - -Additionally, Stale-While-Revalidate is now enabled by default, it also will correctly respond with 304 Not Modified -codes, avoiding extra bills for your hosting. - -### Prerendering Improvements - -With the introduction of the Nitro `prerender:config` hook ([#1519](https://github.com/unjs/nitro/pull/1519)), the module -can now natively handle the prerendering of screenshots, allowing you to make use of concurrency. - -This also means that if you're generating your app with `nuxi generate`, that the module will no longer bundle -any Satori or Playwright dependencies. - -### Pre-existing OG Images - -In some cases, you'll have a page that you already have a designed OG Image for that you want to use -instead of the dynamically generated one. - -In those cases you can now provide a `url` to `defineOgImage` and all the tags will be set up properly for you. - -```ts -defineOgImage({ url: 'https://example.com/og.png' }) -``` - -### Simple HTML OG Images - -If you want to simplify your integration, you can provide raw HTML to the `defineOgImage` composable instead -of creating a new component. - -```ts -defineOgImage({ - html: `
-
hello world
-
`, -}) -``` - -### Opt-ing out of OG Images - -On some pages, you may want to disable the OG Image generation, you can now do this with by providing a false -value for the options. - -```ts -// removes all of the og image tags -defineOgImage(false) -``` - -## ⚠️ Breaking Changes - -Trying to migrate? Check the [v2 to v3 migration guide](/og-image/migration-guide/v3). - -### Nuxt Config - -- `playground` has been removed, if you have Nuxt DevTools enabled then the playground will always be enabled -- `runtimeBrowser` has been removed -- `runtimeSatori` has been removed - -### Nuxt Hooks - -- `og-image:prerenderScreenshots` is no longer supported -- `og-image:config` has been removed - -### OG Image Options - -- `provider` renamed to `renderer`, the `browser` provider is now `chromium` -- `cacheTtl` renamed to `cacheMaxAgeSeconds` -- `cache`, `cacheKey`, `static` are removed -- You can no longer pass non-typed keys, you should provide props to the `props` key or use `defineOgImageComponent`. - -The default template is now called `NuxtSeo`, previously it was called `Fallback`. - -### Composables - -The following composables have been removed: - -- `defineOgImageStatic` -- `defineOgImageDynamic` -- `defineOgImageCached` -- `defineOgImageWithoutCache` - -### Components - -The following components have been removed: - -- `OgImageStatic` -- `OgImageDynamic` -- `OgImageCached` -- `OgImageWithoutCache` - -The remaining components `OgImage` and `OgImageScreenshot` are no longer global. If you need -to use them with Nuxt Content, set `componentOptions`. - -```ts -export default defineNuxtConfig({ - ogImage: { - componentOptions: { - global: true, - }, - }, -}) -``` diff --git a/docs/content/3.og-image/_dir.yml b/docs/content/3.og-image/_dir.yml deleted file mode 100644 index 27a503ac..00000000 --- a/docs/content/3.og-image/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: OG Image diff --git a/docs/content/0.nuxt-seo/4.releases/_dir.yml b/docs/content/4.releases/_dir.yml similarity index 100% rename from docs/content/0.nuxt-seo/4.releases/_dir.yml rename to docs/content/4.releases/_dir.yml diff --git a/docs/content/4.schema-org/0.getting-started/1.installation.md b/docs/content/4.schema-org/0.getting-started/1.installation.md deleted file mode 100644 index 4ec6f06d..00000000 --- a/docs/content/4.schema-org/0.getting-started/1.installation.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: 'Install Nuxt Schema.org' -description: 'Get started with Nuxt Schema.org by installing the dependency to your project.' -navigation: - title: 'Installation' ---- - -## Recommendations - -SSR is highly recommended for Nuxt Schema.org. - -Ensure you haven't disabled SSR using `ssr: false` in your `nuxt.config`. - -## Setup - -1. Install `nuxt-schema-org` dependency to your project: - -```bash -npx nuxi@latest module add schema-org -``` - -2. Configure your site details. - -It's recommended to set a canonical site URL to avoid duplicate content issues, as well as a site name -for better default configuration. - -The easiest way to add it in your `nuxt.config`: - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - site: { - url: 'https://example.com', - name: 'My Website', - } -}) -``` - -To learn about other ways to configure your site config, head over to the [Nuxt Site Config docs](/site-config/getting-started/how-it-works). - -## Next steps - -That's it! - -By default, the module will insert default Schema.org nodes for you, learn more about the [Default Schema.org](/schema-org/guides/default-schema-org) setup. diff --git a/docs/content/4.schema-org/0.getting-started/3.stackblitz.md b/docs/content/4.schema-org/0.getting-started/3.stackblitz.md deleted file mode 100644 index a5ce6376..00000000 --- a/docs/content/4.schema-org/0.getting-started/3.stackblitz.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -title: Stackblitz -description: "Nuxt Schema.org StackBlitz playgrounds let you experiment and make reproductions." ---- - -You can use the Nuxt Schema.org Stackblitz playgrounds for either: -- Playing around with the module in a sandbox environment -- Making reproductions for issues (Learn more about [Why Reproductions are Required](https://antfu.me/posts/why-reproductions-are-required)) - -## Stackblitz Playgrounds - -- [Basic](https://stackblitz.com/edit/nuxt-starter-z9np1t?file=app.vue) diff --git a/docs/content/4.schema-org/0.getting-started/_dir.yml b/docs/content/4.schema-org/0.getting-started/_dir.yml deleted file mode 100644 index bcd2ba14..00000000 --- a/docs/content/4.schema-org/0.getting-started/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Getting Started diff --git a/docs/content/4.schema-org/0.getting-started/how-it-works.md b/docs/content/4.schema-org/0.getting-started/how-it-works.md deleted file mode 100644 index 9cdb5a0a..00000000 --- a/docs/content/4.schema-org/0.getting-started/how-it-works.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: How It Works -description: Learn more about how Nuxt Schema.org works. ---- - -Nuxt Schema.org will generate structured data for your site based on the input you provide and the content of your pages. - -This is used to help search engines understand your content better and provide more relevant search results. - -For a more technical details on how schema.org is generated, you can read the [official documentation](https://unhead.unjs.io/schema-org/getting-started/how-it-works). - -## LD+JSON tag - -The schema is injected within a ` -``` - -## Opt-out - -If you don't want to use the default setup, you can opt-out by setting `defaults: false` in your `nuxt.config`: - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - schemaOrg: { - defaults: false - } -}) -``` - -## Configuring Identity - -Please see the [Setup Identity](/schema-org/guides/quick-setup) guide for more information on configuring your identity. diff --git a/docs/content/4.schema-org/2.guides/1.quick-setup.md b/docs/content/4.schema-org/2.guides/1.quick-setup.md deleted file mode 100644 index 757abc41..00000000 --- a/docs/content/4.schema-org/2.guides/1.quick-setup.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: Setup Identity -description: Set up Schema.org on your Nuxt app quickly. ---- - -By default, a Nuxt plugin is registered in your app that will register the root nodes for a -`WebSite` and `WebPage` for you. - -These are configured using [Nuxt Site Config](/site-config/getting-started/how-it-works), - -The only configuration you may need to provide is the identity of your site. - -## Selecting An Identity - -Beforehand you'll need to decide on what type of identity you want to use. - -You can use either [Organisation](https://unhead.unjs.io/schema-org/recipes/identity#organization) or [Person](https://unhead.unjs.io/schema-org/recipes/identity#person), learn -more about their differences on the [Choosing an identity](https://unhead.unjs.io/schema-org/recipes/identity) docs. - -## Setup - -The simplest way to set up your identity is to set it in your `nuxt.config` using a string: - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - schemaOrg: { - identity: 'Organization' // or 'Person' - } -}) -``` - -For more complex configurations, you can provide an object with the `type`: - -```ts [nuxt.config.ts] -export default defineNuxtConfig({ - schemaOrg: { - identity: { - type: 'Organization', - name: 'My Company', - url: 'https://example.com', - logo: 'https://example.com/logo.png' - } - } -}) -``` diff --git a/docs/content/4.schema-org/2.guides/2.nodes.md b/docs/content/4.schema-org/2.guides/2.nodes.md deleted file mode 100644 index cd79c38c..00000000 --- a/docs/content/4.schema-org/2.guides/2.nodes.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: Supported Nodes -description: The nodes available for Nuxt Schema.org. ---- - -The module exposes the officially supported nodes from [Unhead Schema.org](https://unhead.unjs.io/schema-org/schema). Official nodes -are ones that have a direct impact on Google Rich Results. - -## Custom Nodes - -If you need to add a node that isn't implemented, then you can provide it yourself. - -Custom nodes are just plain objects that follow the [Schema.org specification](https://schema.org/docs/full.html). - -If you'd like to add types, you can use [schema-dts](https://github.com/google/schema-dts). - -::code-group - -```vue [Untyped] - -``` - -```vue [schema-dts] - -``` - -:: - -## Official nodes - -The scope for officially supported nodes is those that provide Rich Results within Google. - -:SchemaOrgNodeList{} diff --git a/docs/content/4.schema-org/2.guides/3.full-documentation.md b/docs/content/4.schema-org/2.guides/3.full-documentation.md deleted file mode 100644 index 701ad85d..00000000 --- a/docs/content/4.schema-org/2.guides/3.full-documentation.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: Full Documentation ---- - -The Nuxt Schema.org package is a simple wrapper around [Unhead Schema.org](https://unhead.unjs.io/schema-org/recipes/identity), you should consult -the official documentation for full details. - -## Popular Nodes - -- [Organization](https://unhead.unjs.io/schema-org/schema/organization) -- [Person](https://unhead.unjs.io/schema-org/schema/person) -- [WebSite](https://unhead.unjs.io/schema-org/schema/website) -- [WebPage](https://unhead.unjs.io/schema-org/schema/webpage) -- [Article](https://unhead.unjs.io/schema-org/schema/article) - -## Popular Recipes - -- [Identity](https://unhead.unjs.io/schema-org/recipes/identity) -- [Blog](https://unhead.unjs.io/schema-org/recipes/blog) -- [Breadcrumb](https://unhead.unjs.io/schema-org/recipes/breadcrumb) -- [FAQ](https://unhead.unjs.io/schema-org/recipes/faq) diff --git a/docs/content/4.schema-org/2.guides/7.debugging.md b/docs/content/4.schema-org/2.guides/7.debugging.md deleted file mode 100644 index 01166ea2..00000000 --- a/docs/content/4.schema-org/2.guides/7.debugging.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: Debugging -description: How to debug the Schema.org generated from Nuxt Schema.org. ---- - -It's recommended test your Schema.org output whenever your deploying any Schema.org updates. - -To do so, you can make use of the debugging features. - -## Nuxt DevTools - -The best tool for debugging is the Nuxt DevTools integration with Nuxt Schema.org. - -This will give you your Schema.org graph and handy links to test it. - -This is enabled by default in development, simply navigate to the Schema.org tab. - -## Debug Endpoint - -A debug endpoint is available when `debug` is on at `/__schema-org__/debug.json`. This provides -basic runtime data used to generate the Schema.org graph. - -## External Debugging Tools - -You can test your Schema.org using the following tools: -- [Google Rich Results Test](https://search.google.com/test/rich-results) -- [Schema.org Validator](https://validator.schema.org/) diff --git a/docs/content/4.schema-org/2.guides/_dir.yml b/docs/content/4.schema-org/2.guides/_dir.yml deleted file mode 100644 index e9454921..00000000 --- a/docs/content/4.schema-org/2.guides/_dir.yml +++ /dev/null @@ -1 +0,0 @@ -title: Guides diff --git a/docs/content/4.schema-org/4.api/0.config.md b/docs/content/4.schema-org/4.api/0.config.md deleted file mode 100644 index 2d256fe0..00000000 --- a/docs/content/4.schema-org/4.api/0.config.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -title: Nuxt Config -description: Configure the sitemap module. ---- - -## `identity` - -- Type: `'Person' | 'Organization' | Person | Organization` -- Default: `undefined` - -The identity of your site. This will only have an effect when using `defaults`. - -## `defaults` - -- Type: `boolean` -- Default: `true` - -Whether the default Schema.org setup should be enabled or not. - -## `minify` - -- Type: `boolean` -- Default: `process.env.NODE_ENV === 'production'` - -Whether the Schema.org output should be minified or not. Will slightly reduce your bundle size. - -## `reactive` - -- Type: `boolean` -- Default: `nuxt.options.dev || !nuxt.options.ssr` - -Whether client-side reactivity should be enabled or not. This is not needed for SEO reasons when SSR but may be useful for debugging. - -## `scriptAttributes` - -- Type: `(ScriptBase & TagUserProperties) | false` -- Default: `{ id: 'schema-org-graph' }` - -The attributes to add to the ` - - diff --git a/docs/.nuxtrc b/nuxtseo.com/.nuxtrc similarity index 100% rename from docs/.nuxtrc rename to nuxtseo.com/.nuxtrc diff --git a/docs/app.config.ts b/nuxtseo.com/app.config.ts similarity index 100% rename from docs/app.config.ts rename to nuxtseo.com/app.config.ts diff --git a/docs/app.vue b/nuxtseo.com/app.vue similarity index 78% rename from docs/app.vue rename to nuxtseo.com/app.vue index 75fdff02..fd5eb6cf 100644 --- a/docs/app.vue +++ b/nuxtseo.com/app.vue @@ -3,7 +3,29 @@ import { useModuleList } from '~/utils/data' const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation()) +const route = useRoute() +const publicRuntimeConfig = useRuntimeConfig().public +const segment = computed(() => route.path.split('/')[1]) +const children = computed(() => { + console.log('finding children for segment', segment.value, navigation!.value!.filter(i => i._path === `/${segment.value}`)) + return navigation!.value!.find(i => i._path === `/${segment.value}`)?.children || [] +}) + provide('navigation', navigation) +provide('docsAsideLinks', children) +provide('module', computed(() => { + const m = useModuleList().find(l => l?.slug === segment.value) + const stats = (publicRuntimeConfig.moduleStats || []).find(m2 => m2.id === m?.id)?.stats || {} + if (stats?.downloads) { + // will look like 395493, we need to make it human readible using native APIs + // we want to display it like 395k + m.downloads = Number(stats.downloads).toLocaleString('en-US', { notation: 'compact', compactDisplay: 'short' }) + } + if (stats?.stars) + m.stars = stats.stars + + return m +})) const modules = useModuleList() @@ -25,7 +47,7 @@ useSeoMeta({ -