ab.ncvp.me

an Astro site with mainly posts

Add post metadata

Posted on 27th May 2026 at 10:30 by Admin


Gemini

Astro automatically adds a special property called file to the Astro.props object of your Markdown files. This property contains the absolute system path to that specific file.

Create PostMeta.astro component

in src/components.
Just prints the file path and URL slug if showMeta is true.

src/pages/blog/[…slug].astro

Get the value of showMeta. Display the meta info at the bottom of the page if true.

Modify schema

Add optional showMeta flag to /src/content.config.ts

Sure enough, it only lasted a few days

Category: misc Tags: post file-name url-slug md mdx

Rendered by src/pages/blog/[slug].astro