博客概覽

博客模塊為博客站點提供了基本的佈局和模板。

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.

站點參數

ParameterTypeDefaultDescription
blog.full_widthbooleanfalse是否全寬。
blog.list_cols_mdnumber2md 斷點下,列表每行的文章數目。
blog.list_cols_lgnumber3lg 斷點下,列表每行的文章數目。
blog.paginatenumber9每頁博文數量。
blog.post_date_formatstring:date_long博文日期格式。
blog.post_read_morebooleantrue是否顯示閱讀更多按鈕。
blog.post_thumbnailbooleantrue是否顯示縮略圖。
blog.post_thumbnail_defaultstringimages/thumbnail.png相對於 assets 文件夾的默認縮略圖。
blog.post_thumbnail_heightstring160px縮略圖高度。
blog.post_thumbnail_placeholderstring站點標題縮略圖佔位符。
blog.post_thumbnail_positionstringtop縮略圖的位置,starttop
blog.post_thumbnail_resize_heightstring360縮略圖縮放的高度。
blog.archivesobject歸檔設置。
blog.archives.paginatenumber30歸檔每頁博文數量。
blog.homeobject博客首頁設置。
blog.home.featured_postsnumber10特刊博文數量。
blog.home.main_sectionsarray-博文欄目,默認所有欄目。
blog.home.pinned_posts_positionstring幻燈片右側置頂文章的位置,可選項:list
blog.home.taxonomiesbooleantrue是否於首頁顯示分類統計。
blog.toc.positionstringendstart:內容左側、end:內容右側、content:內容上方。
blog.list_stylestring-空字符串、minimalistcascade
terms.list_stylestring-空字符串、minimalistcascade
terms.paginatenumber12分類列表博文數量。
terms.profilebooleantruefalse 時,隱藏簡介。
terms.profile_metricsbooleantruefalse 時,隱藏簡介上的指標。

params.toml

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

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    list_style: ""
15    paginate: 12
16    post_date_format: :date_long
17    post_thumbnail: true
18    post_thumbnail_default: images/thumbnail.png
19    post_thumbnail_placeholder: ""
20    post_thumbnail_position: top
21    toc:
22      position: end
23  terms:
24    list_style: ""
25    paginate: 12
26    profile: true
27    profile_metrics: true

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         "list_style": "",
19         "paginate": 12,
20         "post_date_format": ":date_long",
21         "post_thumbnail": true,
22         "post_thumbnail_default": "images/thumbnail.png",
23         "post_thumbnail_placeholder": "",
24         "post_thumbnail_position": "top",
25         "toc": {
26            "position": "end"
27         }
28      },
29      "terms": {
30         "list_style": "",
31         "paginate": 12,
32         "profile": true,
33         "profile_metrics": true
34      }
35   }
36}

頁面參數

NameTypeDefaultDescription
commentsbooleantrue是否顯示評論。
external_urlstring-外部文章 URL。
featuredbooleanfalse是否於首頁幻燈片中顯示該文章。
pinnedbooleanfalse是否於首頁置頂該文章。
tocbooleantrue是否顯示文章目錄。
metaboolean/objecttruefalse 时,禁用所有元信息。
meta.authorsbooleantruefalse 时,禁用作者元信息。
meta.datebooleantruefalse 时,禁用日期元信息。
meta.reading_timebooleantruefalse 时,禁用阅读时长元信息。
meta.taxonomiesbooleantruefalse 时,禁用专栏、分类和标签元信息。
meta.first_sectionbooleantrue是否顯示文章的根欄目。

歸檔

博客博客內置了文章歸檔佈局,其可以按年份和月份進行歸檔。你需要手動創建欄目以歸檔文章。

創建歸檔欄目

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

創建按年歸檔欄目

archives/2023/ 為例。

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

創建按月歸檔欄目

archives/2023/01/ 為例。

razonyang
2024年7月26日 星期五 2023年3月31日 星期五