1 min read
pyssg.presets.blog
blog preset: a ready-to-use blog.
Like the :mod:pyssg.presets.docs preset, this returns a fully populated
:class:~pyssg.Config so the basic user writes a one-line pyssg.config.py::
from pyssg.presets import blog
config = blog(site={"title": "My Blog"}, base_url="https://example.com")
Convention: posts live under content/posts/. They are collected into a
posts collection, sorted newest-first by their date frontmatter, and
paginated; page 1 is the site home (/) and page N is /page/N/. Override
posts_route/posts_per_page to taste, or pass extra_plugins to append
your own plugins without losing the defaults.
blog(*, site: dict[str, object] | None = None, base_url: str = '', content_dir: str = 'content', output_dir: str = 'dist', layout: str | Path | None = None, posts_dir: str = 'posts', posts_route: str = '/', posts_per_page: int = 5, highlight_style: str = 'default', rss_title: str | None = None, extra_plugins: Iterable[Plugin] | None = None) -> Config
Build a :class:Config for a blog.
Posts are documents under content/<posts_dir>/; they are collected,
sorted newest-first by date, and paginated at posts_route with
posts_per_page per page. layout defaults to the built-in blog
theme.