圖庫概覽

圖庫概覽

圖庫模塊爲圖片提供了一個簡單的佈局。

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

站點配置

ParameterTypeDefaultDescription
paginatenumber24每頁圖片數量。
thumbnail_sizestringx640縮略圖尺寸:[width]x[height][width]xx[height]

params.toml

1[hb]
2  [hb.gallery]
3    paginate = 24
4    thumbnail_size = 'x640'

params.yaml

1hb:
2  gallery:
3    paginate: 24
4    thumbnail_size: x640

params.json

1{
2   "hb": {
3      "gallery": {
4         "paginate": 24,
5         "thumbnail_size": "x640"
6      }
7   }
8}

創建圖庫欄目

content/gallery/_index.md
1---
2title: Gallery
3---

創建相冊

content/gallery/hello/_index.md
 1---
 2title: "Hello"
 3date: 2022-01-01T16:16:05+08:00
 4resources:
 5  - src: 20230101000000.jpg
 6    params:
 7      author: Foo
 8      source: example.com
 9  - src: 20230102000000.png
10    params:
11      author: Bar
12      source: example.com
13---

然後將圖片保存到 content/gallery/hello 目錄,還可以進一步描述圖片

相冊社交分享圖片

feature* 形式命名的圖片將會作爲社交分享的圖片,如 20220101-featured.jpg

也可以使用 images 參數指定,僅適用於 static 圖片和外部圖片。

1images = ['https://example.com/images/feature.png']
1images:
2- https://example.com/images/feature.png
1{
2   "images": [
3      "https://example.com/images/feature.png"
4   ]
5}

圖片屬性

The image names will be used by sorting, you should apply same pattern on images filenames, such as date.

PropertyTypeRequiredDescription
srcstringYThe name of image.
paramsobject-The image parameters.
params.authorstring-The author/painter.
params.sourcestring-The source of image.