Rendering Page Titles comes as an object

This seems to be an interesting issue as when trying to render the page title, [object Object] comes up instead of the title. have to render it as {document.data.title[0].text} in order for the title to appear. nothing serious but wondering if that was the intent? simply just created a variable to title to avoid too much syntax

If that is RichText, you will need to call it in {PrismicDom.RichText.asHtml(document.data.title)}

Note: using the DOM library, you need to install it as a dev dependency because of how Svelte is handling the SSR part of what to load as dependencies. So npm i -D prismic-dom

If it ends up in "dependencies", then the package isn't available when rendering.

If that field is a normal Text field, then you shouldn't need to be doing that extra bit.

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.