Skip to content

Commit 9fdcf2b

Browse files
iManugregberge
authored andcommitted
feat: add hreflang support in HeadMeta (#36)
1 parent 071fb29 commit 9fdcf2b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

packages/smooth-plugin-head-meta/src/definitions/HeadMeta.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ export const typeDefs = gql`
1111
content: String @field(label: "Content")
1212
}
1313
14+
type HreflangLink {
15+
rel: String @field(label: "rel")
16+
href: String @field(label: "href")
17+
hreflang: String @field(label: "hreflang")
18+
}
19+
1420
type HeadMeta {
1521
title: String @field(label: "Title")
1622
description: String @field(label: "Description")
@@ -27,5 +33,6 @@ export const typeDefs = gql`
2733
twitterDescription: String @field(label: "Twitter description")
2834
twitterImage: Image @field(label: "Twitter image")
2935
customMetas: [CustomMeta] @field(label: "Custom metadatas")
36+
hreflangLinks: [HreflangLink] @field(label: "hreflang links")
3037
}
3138
`

packages/smooth-plugin-head-meta/src/smooth-browser.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ function HeadMeta({ headMeta }) {
3737
headMeta.customMetas.map((meta, index) => (
3838
<meta key={index} name={meta.name} content={meta.content} />
3939
))}
40+
{headMeta.hreflangLinks &&
41+
headMeta.hreflangLinks.map((link, index) => (
42+
<link
43+
key={index}
44+
rel={link.rel}
45+
href={link.href}
46+
hrefLang={link.hreflang}
47+
/>
48+
))}
4049
</Helmet>
4150
)
4251
}
@@ -73,6 +82,11 @@ headMeta {
7382
name
7483
content
7584
}
85+
hreflangLinks {
86+
rel
87+
href
88+
hreflang
89+
}
7690
}
7791
`,
7892
]

0 commit comments

Comments
 (0)