diff --git a/app/[[...path]]/page.tsx b/app/[[...path]]/page.tsx index a3df97f0c781f..e8b94fb86ba52 100644 --- a/app/[[...path]]/page.tsx +++ b/app/[[...path]]/page.tsx @@ -132,6 +132,17 @@ type MetadataProps = { }; }; +// Helper function to clean up canonical tags missing leading or trailing slash +function formatCanonicalTag(tag: string) { + if (tag.charAt(0) !== '/') { + tag = '/' + tag; + } + if (tag.charAt(tag.length - 1) !== '/') { + tag = tag + '/'; + } + return tag; +} + export async function generateMetadata({params}: MetadataProps): Promise { const domain = isDeveloperDocs ? 'https://develop.sentry.dev' @@ -142,6 +153,7 @@ export async function generateMetadata({params}: MetadataProps): Promise diff --git a/docs/platforms/javascript/common/sourcemaps/uploading/vite.mdx b/docs/platforms/javascript/common/sourcemaps/uploading/vite.mdx index f164773a9ec9b..41ccd84a26b10 100644 --- a/docs/platforms/javascript/common/sourcemaps/uploading/vite.mdx +++ b/docs/platforms/javascript/common/sourcemaps/uploading/vite.mdx @@ -1,6 +1,7 @@ --- title: Vite description: "Upload your source maps with the Sentry Vite Plugin." +customCanonicalTag: "/platforms/javascript/sourcemaps/uploading/vite/" sidebar_order: 3 --- diff --git a/docs/platforms/javascript/common/sourcemaps/uploading/webpack.mdx b/docs/platforms/javascript/common/sourcemaps/uploading/webpack.mdx index c5770e9009703..614f922c9064d 100644 --- a/docs/platforms/javascript/common/sourcemaps/uploading/webpack.mdx +++ b/docs/platforms/javascript/common/sourcemaps/uploading/webpack.mdx @@ -1,6 +1,7 @@ --- title: Webpack description: "Upload your source maps with our webpack plugin." +customCanonicalTag: "/platforms/javascript/sourcemaps/uploading/webpack/" sidebar_order: 1 --- diff --git a/src/types/frontmatter.ts b/src/types/frontmatter.ts index 708b1cbd20997..92b7944e2ad8a 100644 --- a/src/types/frontmatter.ts +++ b/src/types/frontmatter.ts @@ -14,6 +14,8 @@ export interface FrontMatter { /** * A description to use in the header, as well as in auto generated page grids. */ + customCanonicalTag?: string; + /** Add this if you want to add a canonical tag (without this it will default to the page url). Should be a relative path without the domain (e.g. `/platforms/react/options/`) */ description?: string; /** * Set this to true to mark this page as a draft, and hide it from various other components (such as the PageGrid).