Creating templates and programmatic page generation
In this section, we will programmatically generate pages using templates. We will be creating blog pages, blog list preview pages, and tag pages. To make all of this work correctly, it is important to ensure that each node of data that you are ingesting to populate blog pages contains the following:
- Title: The title of the blog post.
- Description: A one-line description of what the blog post contains.
- Date: The date that the post should be published.
- Tags: A list of tags that the blog post is associated with.
- Body: The main content of the post.
If you are sourcing more than one type of content from the same source, it would be a good idea to also include a type field. This will allow you to filter out nodes that don't belong to this type.
The method for adding these to your nodes will change, depending on the source. However, in the case of Markdown, you could create your posts in the following...