Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

folder-level special frontmatter for MD files #3096

Conversation

readonlychild
Copy link

Changes

vite markdown plugin was updated to enable reading special frontmatter layout, components, setup from a special file _config.json that exists in the same folder as the MD file. All MD files in the same folder will load this frontmatter fields.

{
  "layout": "../../layouts/BlogPost.astro",
  "components": "",
  "setup": ""
}

Specifying the fields in the MD frontmatter will override values in the shared JSON file.

Testing

This was tested in the Blog template, by replacing the updated file (minus the TypeScript because it is a .js instead of .ts)

Docs

If PR is accepted, I can work on the docs site to document how this new functionality is enabled and used.

@changeset-bot
Copy link

changeset-bot bot commented Apr 13, 2022

🦋 Changeset detected

Latest commit: 7167bfa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
astro Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Apr 13, 2022
@readonlychild
Copy link
Author

My bad on leaving console.logs in there 🙃
The TypeScript part I would need assistance ☹️

@matthewp
Copy link
Contributor

Hey @readonlychild, happy to help you with this. Please contact me on Discord at your convenience. Going to close for now until this is more ready.

@matthewp matthewp closed this May 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants