Static Site Blog Post Template (Front Matter)
Blog post with YAML front matter (title, date, draft, tags, description, slug) and Hugo, Jekyll and Astro differences
使用方法: Use when writing a post for a static site generator. Fill the front matter first and keep draft true until ready. The main pitfall is generator-specific rules, such as Jekyll's dated file names or Astro's schema validation.
预览
| title | "[Post title]" |
|---|---|
| date | YYYY-MM-DD |
| draft | true |
| tags | ["[tag-one]", "[tag-two]"] |
| description | "[One-sentence summary for search results and social cards, key point first]" |
| slug | "[post-slug]" |
[Post title]
Blog post template for static site generators (Hugo, Jekyll, Astro and similar). It starts with YAML front matter, explains how the three generators differ, then gives a post body structure. Based on the documented conventions of each generator. Replace every
[bracketed]value; delete the notes sections before publishing.
Front matter reference
The same fields, shown on their own so you can copy and adapt them:
---
title: "How we cut our build time in half"
date: 2026-10-21T09:00:00+07:00
draft: false
tags: ["ci", "performance", "github-actions"]
description: "Caching, parallel jobs and smaller images took our CI from 18 to 8 minutes."
slug: "cut-build-time-in-half"
---
| Field | Purpose | Notes |
|---|---|---|
title | Page title and heading | Quote it if it contains a colon |
date | Publication date for sorting and feeds | Future dates may be hidden until that date |
draft | Exclude from production builds | Remove or set false to publish |
tags | Taxonomy pages and related posts | Use lowercase, hyphenated tags consistently |
description | Meta description and social preview | No fixed limit in Google Search; snippets are truncated to fit the screen, so lead with the key point |
slug | URL segment | Lowercase, hyphens, no dates unless your permalinks need them |
Generator differences
| Topic | Hugo | Jekyll | Astro |
|---|---|---|---|
| Where posts live | content/posts/ (or any section) | _posts/ | Anywhere: a collection defined in src/content.config.ts points a glob() loader at a folder (for example src/content/blog/) |
| File name | Any, for example my-post.md or a page bundle my-post/index.md | Must be YYYY-MM-DD-title.md | Any; glob() derives the entry ID from the file name |
| Drafts | draft: true, built only with --buildDrafts (-D) | Put the file in _drafts/, or published: false; preview with --drafts | No built-in rule; filter draft yourself in getCollection() |
| Front matter formats | YAML, TOML (+++) or JSON | YAML only | YAML (TOML also supported in current versions); fields are validated by the collection schema |
| Slug | slug overrides the last URL segment | slug used with the permalink pattern in _config.yml | The content collections guide says a slug field overrides the glob() entry ID; generateId() gives full control. Routes come from your page code |
| Tags | Built-in taxonomies (tags, categories) | tags and categories are built in | Define tags in the schema; build tag pages yourself |
| Summary | description or summary, or text before <!--more--> | excerpt or the first paragraph | Any field you define, usually description |
Version note: checked in October 2026 against the official Hugo
front matter page, the Jekyll posts and front matter pages, and the
Astro content collections guide (Astro 5 and later use the content
layer API with src/content.config.ts; older Astro versions used
src/content/config.ts and required posts inside src/content/).
Check the documentation for the version your site runs.
Post body
Introduction
[Two or three sentences: the problem or question, who it is for, and what the reader will get from the post.]
[Main section 1]
[Explain the first key point with an example, code block or image.]
[Main section 2]
[Second key point. Keep headings descriptive so readers can skim.]
[Main section 3]
[Third key point, or a step-by-step walkthrough.]
Conclusion
[Summarise the takeaway in two sentences and suggest one next step, such as a related post or a link to the code.]
Before publishing
-
draftset tofalse(Hugo, Astro) or file moved to_posts/(Jekyll). - Images stored next to the post or in the static folder, with alt text.
- The local preview build shows the post at the expected URL.
- Description reads well as a search snippet.
References
- Hugo, Front matter: https://gohugo.io/content-management/front-matter/
- Jekyll, Posts: https://jekyllrb.com/docs/posts/ and Front Matter: https://jekyllrb.com/docs/front-matter/
- Astro, Content collections: https://docs.astro.build/en/guides/content-collections/
- Google Search Central, Control your snippets in search results: https://developers.google.com/search/docs/appearance/snippet
Related: writing/blog-post, writing/technical-article,
marketing/seo-brief.
Standard and licence note
Based on the documented front matter conventions of Hugo, Jekyll and Astro as published in October 2026. Generator behaviour changes between versions; check your version's documentation. Original text written for this collection. Template licence: MIT.
相关模板
Blog Post Template
Long-form blog post: search metadata, hook, body, mistakes and reader questions, sources, byline and dates, disclosure, pre-publish checklist
写作与内容Book Chapter Template
Book chapter: outline (opening, turn, close), scene list, draft, word-count tracker, continuity notes, revision checklist
写作与内容Nonfiction Book Proposal Template
Nonfiction book proposal: hook, author platform, audience, comparable titles, marketing plan, chapter outline, sample chapter, specs