Next.js Discord

Discord Forum

Updating frontmatter for all .mdx files in a directory.

Unanswered
Leafcutting bee posted this in #help-forum
Open in Discord
Leafcutting beeOP
I am working on implementing this by loading in the file and then perfoming string manipulation like so:
- Isolate frontmatter
- Find line within frontmatter that begins with key
- Overwrite that line
- Add frontmatter back to file contents
- Write contents back to file

I was just wondering if there are any better ways of doing this?

0 Replies