Title is rendering as an object ... still

Upon calling my h1 like: <h1> {document.data.title} </h1>

... It's rendering as [object Object] ??
** in my page it's a Key Text Field and not rich text; fyi :slight_smile:

** as per other similar post my @prismic-dom is installed as a devDependency

Any help thank you ahead of time!

Hello Amy,

Welcome to the Prismic community Forum.

I need more information from you to solve this issue. Like:

  1. What framework are you using?
  2. How are you querying the Prismic document? Can you post the query here?
  3. What is this query returning on the console in the object? Can you post the query here?


Yep! Sorry so the framework is SvelteKit
** Following this tutorial post: How to Make a Website with SvelteKit in 15 Minutes - Prismic
Actually for some reason it's returning Null and not an object now: it's a Key Text Field from Prismic on a Page Document with the API ID of title; which should end up the title inside of an h1 tag.

I just cloned the repo so it's exactly the same as on GitHub...GitHub - samlfair/svelte-tutorial: This repo is the final product of the above tutorial. It is a two-page website using Svelte and Sveltekit with content managed in Prismic.

<script context="module">
  import Client from "./../../utils/client";
  import PrismicDom from "prismic-dom";

  export async function load({ page }) {
    const { uid } = page.params;
    const document = await Client.getByUID("page", uid);
    return {
      props: {

Also the h1 is being called like: (once again just like the GitHub)


Hope this helps :slight_smile: Thank you!

:upside_down_face: :roll_eyes: :upside_down_face:

Ok it's working now... sorry I have NO idea what I did to fix it other than I unpublished the pages and made them again. When I refreshed walaa ... hope I didn't cause anyone too much time!!

Anyway happy it's working now!!

:grin: :grin:

Hello @asbilly92

I am glad that it is working for you. Don't hesitate to reach out to us if you have any questions.


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