Posts#
The blog is built with ABlog, an extension for
Sphinx that adds posts, tags, categories, archives and feeds to ordinary
reStructuredText pages. A post is just a page with a post directive in it.
Write a post#
Create a file in
source/posts/, for examplesource/posts/my_first_post.rst.Add the
postdirective and a title:.. post:: 2026-07-10 :tags: example, first-post :category: Code :author: Sam Khalilian My First Post ============= The content of the post goes here.
Rebuild the site (see Build and Publish). The post appears in the blog archive, on its category and tag pages, in the feed, and in the “Latest posts” list on the home page.
The directive can sit above or below the title. The options are:
Option |
Meaning |
|---|---|
|
Publication date, written as |
|
Comma-separated tags. Each tag gets its own page. |
|
The category, such as |
|
Must match a name in |
Posts do not need a toctree entry. ABlog collects them from the post directive.
Listing posts#
The postlist directive builds a list of posts. This site uses it twice. index.rst shows the latest five posts:
.. postlist:: 5
:date: %d-%b-%Y
:format: {date} - {title}
:list-style: none
posts/index.rst, the page behind the “Posts” menu entry, lists every post with its excerpt:
.. postlist::
:excerpts:
Generated pages#
ABlog writes these pages into the built site, with no extra files to maintain:
blog.html All posts, newest first
blog/archive.html Archive of all posts
blog/<year>.html One page per year, e.g. blog/2026.html
blog/category.html List of categories
blog/category/<name>.html One page per category, lower case, e.g. blog/category/math.html
blog/author/<name>.html One page per author, e.g. blog/author/sam-khalilian.html
blog/atom.xml Atom feed
Posts that use :tags: also get tag pages. The category pages are what the “Browse by topic” cards on the home page
link to. The feed needs blog_baseurl in conf.py to be set to the real address of the site (see Project Structure and Configuration).
The ABlog command line#
ABlog also ships a command line (ablog build, ablog serve, ablog deploy). This site does not use it to
build: sphinx-build (see Build and Publish) produces the same pages in _build/html, whereas ablog build writes to
a separate _website folder. The only command worth knowing is ablog deploy, an alternative way to publish
(see GitHub Pages). The command reference lists the
rest.