Hexo中Masonry创建不同相册页面

Micheal Chen Lv6
  • 在hexo-theme-redefine/layout/pages/masonry/masonry.ejs中,将
1
const images = theme.masonry;

修改为:

1
2
3
const images = page.masonry
? page.masonry
: theme.masonry;
  • 在不同的页面Front-Matter中,定义使用的图片,比如:
1
2
3
4
5
6
7
8
9
10
11
12
---
title: Example Page
date: 2025-03-28 06:01:50
template: masonry
masonry:
- image: Image URL
title: Image Title
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec euismod
- image: https://picsum.photos/id/12/2500/1800
title: Lorem ipsum
description: Lorem ipsum dolor sit amet
---
  • _data/masonry.yml文件必须保留且不为空,以保证masonry正确处理,比如:
1
- image: 'image-placeholder'
  • Title: Hexo中Masonry创建不同相册页面
  • Author: Micheal Chen
  • Created at : 2025-03-28 18:44:57
  • Updated at : 2025-03-28 21:05:18
  • Link: https://www.xhis.com/hexo/2025/03/28/notes/Hexo中Masonry创建不同相册页面/
  • License: This work is licensed under CC BY-NC-SA 4.0.
On this page
Hexo中Masonry创建不同相册页面