@@ -64,11 +64,11 @@ export const sharedConfig = defineConfig({
64
64
base : "/" ,
65
65
head,
66
66
lastUpdated : false ,
67
- transformHead : ( { pageData } ) => {
68
- const head : HeadConfig [ ] = [ ] ;
67
+ transformPageData ( pageData ) {
68
+ pageData . frontmatter . head ?? = [ ]
69
69
70
70
if ( pageData . frontmatter . canonical ) {
71
- head . push ( [
71
+ pageData . frontmatter . head . push ( [
72
72
"link" ,
73
73
{
74
74
rel : "canonical" ,
@@ -80,7 +80,7 @@ export const sharedConfig = defineConfig({
80
80
// Add page-specific Open Graph and Twitter meta tags
81
81
const title = pageData . frontmatter . title || pageData . title ;
82
82
const description = pageData . frontmatter . description || pageData . description || "A collection of high-performance JavaScript tools written in Rust" ;
83
-
83
+
84
84
// Construct the canonical URL for the page
85
85
let url = "https://oxc.rs" ;
86
86
if ( pageData . relativePath !== "index.md" ) {
@@ -91,18 +91,17 @@ export const sharedConfig = defineConfig({
91
91
}
92
92
93
93
if ( title ) {
94
- head . push ( [ "meta" , { property : "og:title" , content : title } ] ) ;
95
- head . push ( [ "meta" , { name : "twitter:title" , content : title } ] ) ;
94
+ pageData . frontmatter . head . push ( [ "meta" , { property : "og:title" , content : title } ] ) ;
95
+ pageData . frontmatter . head . push ( [ "meta" , { name : "twitter:title" , content : title } ] ) ;
96
96
}
97
97
98
98
if ( description ) {
99
- head . push ( [ "meta" , { property : "og:description" , content : description } ] ) ;
100
- head . push ( [ "meta" , { name : "twitter:description" , content : description } ] ) ;
99
+ pageData . frontmatter . head . push ( [ "meta" , { property : "og:description" , content : description } ] ) ;
100
+ pageData . frontmatter . head . push ( [ "meta" , { name : "twitter:description" , content : description } ] ) ;
101
101
}
102
102
103
- head . push ( [ "meta" , { property : "og:url" , content : url } ] ) ;
103
+ pageData . frontmatter . head . push ( [ "meta" , { property : "og:url" , content : url } ] ) ;
104
104
105
- return head ;
106
105
} ,
107
106
themeConfig : {
108
107
siteTitle : "Oxc" ,
0 commit comments