starlight-blog icon indicating copy to clipboard operation
starlight-blog copied to clipboard

"Missing date" error when using a custom prefix

Open raiden-kaihatsu opened this issue 2 months ago • 2 comments

Describe the bug

When using starlight-blog with a custom prefix to apply its features to an existing content directory (e.g., /tech), the plugin throws a Missing date for blog entry '...' error. This error occurs even though a date field with the format YYYY-MM-DD is correctly defined in the frontmatter of the articles, as shown in the documentation.

To Reproduce

Steps to reproduce the behavior:

  1. Setup Project: Set up a standard Astro Starlight project. Place content files in a subdirectory, for example: src/content/docs/tech/.
  2. Install Plugin: Install starlight-blog using npm i starlight-blog.
  3. Configure Plugin: In astro.config.mjs, import starlight-blog and add it to the Starlight plugins array with a custom prefix.
    starlightBlog({
      prefix: 'tech',
    })
    
  4. Configure Schema: In src/content/config.ts, extend the docsSchema with the blogSchema.
    export const collections = {
      docs: defineCollection({
        schema: docsSchema({
          extend: (context) => blogSchema(context)
        })
      }),
    };
    
  5. Create Content: Ensure an article in src/content/docs/tech/ has a date field in its frontmatter.
    ---
    title: My Article
    date: 2024-09-22
    ---
    
  6. Run Server: Run the development server with npm run dev.
  7. See Error: Observe the Missing date for blog entry... error in the console.

Expected behavior

The plugin should correctly identify the date field from the article's frontmatter. The page should render without errors, and the starlight-blog features (such as tags on the page and the sidebar widgets) should be applied to the articles under the /tech route.

How often does this bug happen?

Every time

System Info

  • Astro: ^5.13.7
  • @astrojs/starlight: ^0.35.3
  • starlight-blog: (latest version)

Additional Context

No response

raiden-kaihatsu avatar Oct 01 '25 11:10 raiden-kaihatsu

Thanks for the report 🙌

I'm not able to reproduce such issue. Here is a StackBlitz example using your configuration and content which works as expected.

Would you be able to provide a reproduction or a link to the repo where you're hitting this issue?

HiDeoo avatar Oct 01 '25 12:10 HiDeoo

Thanks for your reply! I think this is probably an issue specific to my environment, so at some point I’d like you to take a look at my repo. Right now it contains a lot of personal information, so I’ll need to prepare it first.

Anyway, even though I’ve written the date, I keep getting the message “Missing date for blog entry...” endlessly.

In particular, I really want to use the tags feature. Being able to list up articles with specific tags would be great. Honestly, I’d love to see this functionality officially added to Starlight itself.

raiden-kaihatsu avatar Oct 02 '25 09:10 raiden-kaihatsu