#Unexpected error while parsing content entry IDs and slugs.

8 messages · Page 1 of 1 (latest)

bold shale
#

I am using keystatic to author my posts and I have it placing the posts in content/articles/

My config file looks like this:

const articlesCollection = defineCollection({
  schema: z.object({
    title: z.string(),
    excerpt: z.string(),
    publishedAt: z.date(),
    category: z.enum(["catholicism", "life", "short-stories"]),
  }),
});

const filmCollection = defineCollection({
  type: "data",
  schema: z.object({
    title: z.string(),
    embedUrl: z.string().url(),
    videoUrl: z.string().url(),
    summary: z.string(),
  }),
});

export const collections = {
  articles: articlesCollection,
  films: filmCollection,
};

When I try to get articles via getCollection, I get that error in the frontend. Also, accessing films gives a no overload matches this call. I am trying to display the collection in a file with the path/pages/stories/short-stories.astro

smoky swan
#

Some more info would be helpful: How does your short-stories.astro look like? What about your keystatic.config.ts? Is SSR (hybird or server) enabled?

boreal kindle
#

You didn't declare the type of articlesCollection

bold shale
#

keystatic config


  collections: {
    articles: collection({
      label: "Articles",
      slugField: "title",
      path: "src/content/articles/*",
      format: { contentField: "content" },
      // entryLayout: "content", noves content box to middle
      schema: {
        title: fields.slug({ name: { label: "Title" } }),
        publishedAt: fields.date({
          label: "Published at",
          description: "When are we making this live?",
        }),
        category: fields.select({
          label: "Category",
          description: "Where are we writing today?",
          options: [
            { label: "Catholicism", value: "catholicism" },
            { label: "Life", value: "life" },
            { label: "Short Stories", value: "short-stories" },
          ],
          defaultValue: "catholicism",
        }),
        excerpt: fields.text({
          label: "Excerpt",
          multiline: true,
        }),
        content: fields.markdoc({
          label: "What is on your mind?",
          formatting: true,
          dividers: true,
          links: true,
          images: true,
        }),
      },
    })}
#

The astro file

---
import BaseLayout from "@layouts/BaseLayout.astro";
import writing from "@assets/images/write.png";
import { Image } from "astro:assets";
import InnerLayout from "@layouts/InnerLayout.astro";

import { getCollection } from "astro:content";
const catArticles = getCollection("articles");
---

<InnerLayout title="Short Stories" hasAside imgSrc={writing} imgAlt="leopard">
  <h1 class="font-heading text-primary md:text-5xl mb-12 text-4xl text-center">
    <span class="md:text-2xl lg:text-3xl md:mb-4 block mb-6 text-xl">
      Chapter 3
    </span>
    Stories At The Hearth
  </h1>

</InnerLayout>

bold shale
smoky swan