Hello everyone,
I was testing out the integration of Prismic with SvelteKit and noticed something strange. When using the PrismicLink
component to create internal links(link to document), the href
attribute is removed from the anchor tag.
Here's an example of the page data I'm using to generate the links:
{
"navbar": {
// ...
"data": {
"nav_links": [
{
"label": "About",
"link": {
"id": "ZPHhThIAACEAsFJp",
"type": "work_detail",
// ...
"uid": "1",
"link_type": "Document",
"isBroken": false
}
},
{
"label": "Contact",
"link": {
"link_type": "Web",
"url": "https://www.yahoo.com"
}
}
]
}
}
}
I'm passing this data to the PrismicLink
component in an each
loop like this:
{#each data.navbar.data.nav_links as links}
<PrismicLink field={links.link}>
<p>{links.label}</p>
</PrismicLink>
{/each}
However, the rendered output for the internal link is missing the href
attribute:
<a><p>About</p></a>
Can anyone help me understand why this is happening and how to fix it? Thank you!