Blog Overview

The blog module provides the basic layouts and templates for blog site.

Modulegithub.com/hbstack/blog
Repository⭐ Please consider giving a star if your like it.
Stars
Version
Used by
Requirements
License
UsageSee how to use modules.

Site Parameters

ParameterTypeDefaultDescription
blog.full_widthbooleanfalseWhether take full width.
blog.list_cols_mdnumber2The number of posts per list row on md breakpoint.
blog.list_cols_lgnumber3The number of posts per list row on lg breakpoint.
blog.paginatenumber9How many posts per list page.
blog.post_date_formatstring:date_longThe date format.
blog.post_thumbnailbooleantrueWhether to display thumbnail.
blog.post_thumbnail_defaultstringimages/thumbnail.pngThe default thumbnail image relative to assets folder.
blog.post_thumbnail_placeholderstringSite’s titleThe thumbnail placeholder.
blog.post_thumbnail_positionstringtopThe position of thumbnail, start or top.
blog.archivesobjectArchives settings.
blog.archives.paginatenumber30How many posts per page.
blog.homeobjectHomepage settings.
blog.home.featured_postsnumber10The number of featured posts.
blog.home.main_sectionsarray-The main sections of posts, default to ALL.
blog.home.pinned_posts_positionstringNext to carouselThe position of pinned posts, available options: list.
blog.home.taxonomiesbooleantrueWhether to show the taxonomies stat on home page.
blog.toc.positionstringendstart: on the left of content, end: on the right of content, content: above the content.
terms.paginatenumber12The number of posts per term list page.

params.toml

 1[hb]
 2  [hb.blog]
 3    full_width = false
 4    list_cols_lg = 3
 5    list_cols_md = 2
 6    paginate = 12
 7    post_date_format = ':date_long'
 8    post_thumbnail = true
 9    post_thumbnail_default = 'images/thumbnail.png'
10    post_thumbnail_placeholder = ''
11    post_thumbnail_position = 'top'
12    [hb.blog.archives]
13      paginate = 30
14    [hb.blog.home]
15      featured_posts = 5
16      main_sections = ['docs', 'blog']
17      taxonomies = true
18    [hb.blog.toc]
19      position = 'end'
20  [hb.terms]
21    paginate = 12

params.yaml

 1hb:
 2  blog:
 3    archives:
 4      paginate: 30
 5    full_width: false
 6    home:
 7      featured_posts: 5
 8      main_sections:
 9      - docs
10      - blog
11      taxonomies: true
12    list_cols_lg: 3
13    list_cols_md: 2
14    paginate: 12
15    post_date_format: :date_long
16    post_thumbnail: true
17    post_thumbnail_default: images/thumbnail.png
18    post_thumbnail_placeholder: ""
19    post_thumbnail_position: top
20    toc:
21      position: end
22  terms:
23    paginate: 12

params.json

 1{
 2   "hb": {
 3      "blog": {
 4         "archives": {
 5            "paginate": 30
 6         },
 7         "full_width": false,
 8         "home": {
 9            "featured_posts": 5,
10            "main_sections": [
11               "docs",
12               "blog"
13            ],
14            "taxonomies": true
15         },
16         "list_cols_lg": 3,
17         "list_cols_md": 2,
18         "paginate": 12,
19         "post_date_format": ":date_long",
20         "post_thumbnail": true,
21         "post_thumbnail_default": "images/thumbnail.png",
22         "post_thumbnail_placeholder": "",
23         "post_thumbnail_position": "top",
24         "toc": {
25            "position": "end"
26         }
27      },
28      "terms": {
29         "paginate": 12
30      }
31   }
32}

Page Parameters

NameTypeDefaultDescription
commentsbooleantrueWhether to display comments.
external_urlstring-External post URL.
featuredbooleanfalseWhether to display the post on homepage carousel.
pinnedbooleanfalseWhether to pin the post next to the carousel.
tocbooleantrueWhether to show the ToC (Table of Contents).
metaboolean/objecttrueWhen false then disable all meta.
meta.authorsbooleantrueWhen false then disable the authors meta.
meta.datebooleantrueWhen false then disable the date meta.
meta.reading_timebooleantrueWhen false then disable the reading time meta.
meta.taxonomiesbooleantrueWhen false then disable the taxonimies meta: series, categories and tags.

Archives

The blog module ships with a built-in layout for archiving posts, which grouping posts by year and month. To archive posts, you need to generate the archives sections manually.

Create Archives Section

content/archives/_index.md
1---
2title: Archives
3---

Create Archives Section for Year

Takes archives/2023/ as an example.

content/archives/2023/_index.md
1---
2title: 2023
3---

Create Archives Section for Month

Takes archives/2023/01/ as an example.