Each blog post consists of two sections -- the YAML Front Matter and the Markdown Content for the post itself.
Below we'll be looking using the YAML Front Matter to provide items like a blog post title, a category name and more to our posts. If you've not watched the "Getting Started" and "Creating Your First Post" tutorial videos yet, we highly encourage you to go do so, then come back and have a look at the Front Matter reference below.
The Front Matter section of each post, which will contain our YAML items, is surrounded by dashes. We place these dashes above and below. These dashes are the fence that separates our YAML Front Matter from the content.
--- YOUR YAML FRONT MATTER GOES HERE ---
Note: It is important that there be 3 dashes above, and 3 dashes below the front matter. You can see this in action in the examples below as well as in all of the example blog posts we provide with your purchase.
Each and every blog post requires a title in the YAML Front Matter. In fact this is the one and only field that is required in every blog post you create.
--- title: My blog post title goes right here ---
The Category tag allows us to sort our entries into different groupings, which will help our visitors navigate our blog posts much easier to find what they're looking for. A category can be added to our blog posts in the Front Matter like so:
--- title: My blog post title goes right here category: Example Category ---
We can assign an author's name to each post so that our blog's visitors know who wrote which articles. This is an optional field in the Front Matter.
--- title: My blog post title goes right here author: Jane Doe ---
Adding a decorative topper image to our posts is really easy to do in the Front Matter section of our posts. We can provide both a URL for the image, as well as an Alt. Tag for the image, like so:
--- title: My blog post title goes right here topper: https://mysiteurl.com/myimages/topper-image.jpg topperalt: This is the Alt Tag text for my great topper image for this blog post. ---
Here is an example Front Matter section that contains all of the current YAML items that are available to you for your blog posts.
--- title: My blog post title goes right here category: Example Post author: Jane Doe topper: https://mysiteurl.com/myimages/topper-image.jpg topperalt: This is the Alt Tag text for my great topper image for this blog post. ---
The YAML Front Matter will allow us to make even more elements available for blog posts in the future, giving us powerful features to help expand and grow Alloy.