Test Gallery of Jekyll Theme Minimal Mistakes

Aug. 12, 2022

在 YAML Front Matter 中写入:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
gallery:
 - url: /images/PeakyBlinders1.jpg
   image_path: /images/PeakyBlinders1.jpg
   alt: "placeholder image 1"
   title: "Peaky Blinders 1"
 - url: /images/PeakyBlinders2.jpg
   image_path: /images/PeakyBlinders2.jpg
   alt: "placeholder image 2"
   title: "Peaky Blinders 2"
 - url: /images/PeakyBlinders3.jpg
   image_path: /images/PeakyBlinders3.jpg
   alt: "placeholder image 3"
   title: "Peaky Blinders 3"
 - url: /images/PeakyBlinders4.jpg
   image_path: /images/PeakyBlinders4.jpg
   alt: "placeholder image 4"
   title: "Peaky Blinders 4"

之后就可以在正文中引用 gallery ,并且可以选择添加 captain

1
{% include gallery caption="This is a sample gallery with **Markdown support**." %}
placeholder image 1 placeholder image 2 placeholder image 3 placeholder image 4
This is a sample gallery with Markdown support.


或者使用下面的方式引用:

1
{% include gallery id="gallery" caption="This is a sample gallery with **Markdown support**." %}
placeholder image 1 placeholder image 2 placeholder image 3 placeholder image 4
This is a sample gallery with Markdown support.

并且可以使用 COS 图床,只需要更换为相应的 url 即可。


可以添加 class="full" 设置铺满整个 page content container:

1
{% include gallery id="gallery" class="full" caption="This is a third gallery example with two images and fills the entire content container." %}
placeholder image 1 placeholder image 2 placeholder image 3 placeholder image 4
This is a third gallery example with two images and fills the entire content container.


可以使用 layout 属性重载 column layout :

1
{% include gallery id="gallery" layout="half" caption="This is a half gallery layout example." %}
placeholder image 1 placeholder image 2 placeholder image 3 placeholder image 4
This is a half gallery layout example.


References

[1] Post: Gallery - Minimal Mistakes (mmistakes.github.io)