Skip to content

Commit 6d8fcef

Browse files
docs: add support for canonical urls (#393)
1 parent 18c77d6 commit 6d8fcef

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

.vitepress/config/shared.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,21 @@ export const sharedConfig = defineConfig({
5454
base: "/",
5555
head,
5656
lastUpdated: false,
57+
transformHead: ({ pageData }) => {
58+
const head: HeadConfig[] = [];
59+
60+
if (pageData.frontmatter.canonical) {
61+
head.push([
62+
"link",
63+
{
64+
rel: "canonical",
65+
href: pageData.frontmatter.canonical,
66+
},
67+
]);
68+
}
69+
70+
return head;
71+
},
5772
themeConfig: {
5873
siteTitle: "Oxc",
5974
logo: "https://cdn.jsdelivr.net/gh/oxc-project/oxc-assets/round.svg",

0 commit comments

Comments
 (0)