Build a Docusaurus-like Site with FastAPI: Step 4 - Parsing Frontmatter
dev.to·7h·
Discuss: DEV
Flag this post

In the previous article, we added syntax highlighting for our Markdown code blocks.

But you might have noticed that the document page title ({{ page_title }}) is still hardcoded in the main.py route function ("page_title": "Hello, Markdown!"). This is very inflexible. Does this mean we have to modify the code every time we add a new document?

A documentation site needs to be flexible, allowing for articles to be added or removed at any time. The article’s metadata—like its title, author, and date—should be defined within the Markdown file itself, just like the content.

In this article, we will introduce Frontmatter (a common specification for defining metadata at the top of a…

Similar Posts

Loading similar posts...