File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -124,15 +124,16 @@ export default withMermaid(defineConfig({
124124 ] ,
125125
126126 transformPageData ( pageData ) {
127- const canonicalUrl = `https://developers.plane.so/${ pageData . relativePath } `
128- . replace ( / i n d e x \. m d $ / , '' )
129- . replace ( / \. m d $ / , '' )
130-
131- pageData . frontmatter . head ??= [ ]
132- pageData . frontmatter . head . push ( [
133- 'link' ,
134- { rel : 'canonical' , href : canonicalUrl }
135- ] )
127+ const head = pageData . frontmatter . head ??= [ ]
128+ const hasCanonical = head . some (
129+ ( [ tag , attrs ] ) => tag === 'link' && attrs ?. rel === 'canonical'
130+ )
131+ if ( ! hasCanonical ) {
132+ const canonicalUrl = `https://developers.plane.so/${ pageData . relativePath } `
133+ . replace ( / i n d e x \. m d $ / , '' )
134+ . replace ( / \. m d $ / , '' )
135+ head . push ( [ 'link' , { rel : 'canonical' , href : canonicalUrl } ] )
136+ }
136137 } ,
137138
138139 themeConfig : {
You can’t perform that action at this time.
0 commit comments