-
|
hello all, i am trying to render keywords meta tag inside my layout written in webc based on current page tags. i got success rendering thags footer itself, but no luck so far with meta keywords. this is my tags footer: <script webc:type="js" webc:keep webc:is="div">
tags.map(tag => `
<a href="/blog/?tag=${tag.replace(/\s/g,"-")}">${tag}</a>
`).join("")
</script>the meta tag however renders on head section. is there a way to get rid of surrounding tag when using any hint is welcome. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
Can you share the code you’re using to write out the |
Beta Was this translation helpful? Give feedback.
-
|
Noted in the bonus tips section of this part of the docs here: https://www.11ty.dev/docs/languages/webc/#javascript-render-functions-webctypejs-and-webctyperender |
Beta Was this translation helpful? Give feedback.
-
|
@darthmall @zachleat just found the issue, it was between the screen and the chair again 😆 Turns out things are more simpler and easy, i was building a small sample to show the issue but also reading the docs: https://github.com/sombriks/simple-sample-eleventy/blob/main/08-other-template-languages/src/_includes/base-layout.webc So if i need to render a meta tag with keywords (so we can please crawlers and other bots) based on my tags, it's as simple as this:
Then eleventy data cascade does the rest of the job! Thanks for the tips! |
Beta Was this translation helpful? Give feedback.
@darthmall @zachleat just found the issue, it was between the screen and the chair again 😆
Turns out things are more simpler and easy, i was building a small sample to show the issue but also reading the docs: https://github.com/sombriks/simple-sample-eleventy/blob/main/08-other-template-languages/src/_includes/base-layout.webc
So if i need to render a meta tag with keywords (so we can please crawlers and other bots) based on my tags, it's as simple as this:
<meta name="keywords" :content="tags.join(',')">Then eleventy data cascade does the rest of the job!
Thanks for the tips!