A hexo plugin to generate a standalone album page.
Template design repo: XenWayne/masonry-gallery-page
Demo: masonry-gallery-page
The main masonry view is modified based on Fabio Ottaviani 's codepen.
Third-party libraries:
- Install the plugin:
npm install hexo-album-page --save
- Add the following configuration to your
_config.yml
:
album:
enable: true # 是否启用相册插件
site_title: "My Album" # 相册页面的标题
output_path: album/index.html # 相册页面的渲染输出路径
- Create a file named
album.yml
insource/_data
directory, and edit it like this:
categories:
- id: landscape
name: 风景Landscape
description: |
<h1 style="color:#000;">Landscape</h1>
这是一个简单的测试页面,用于展示Masonry瀑布流布局的效果。页面中的图片均为示例图片,来源于网络。
images:
- url: https://gcore.jsdelivr.net/gh/XenWayne/sitefile/img/header_gray.webp
description: |
<b>Title</b> | Subtitle
# 添加更多图片
- id: portrait
name: Portrait测试
description: |
This is an easy test to showcase different apartment styles.
images:
- url: https://s21.ax1x.com/2020/02/08/1RsSc8.jpg
description: |
<b>Title</b> | Subtitle
- url: https://s21.ax1x.com/2020/01/28/1Kd1PK.jpg
description: |
<b>Title</b> | Subtitle
- url: https://s21.ax1x.com/2019/12/28/leCoa8.jpg
description: |
<b>Title</b> | Subtitle
<p>Perfect for singles or couples looking for a comfortable space.</p>
# 添加更多图片
- id: test
name: PixelArt测试
description: |
我是文字啊啦啦啦啦啦嘿嘿嘿嘿额和黑恶黑Lorem ipsum dolor, sit amet consectetur adipisicing elit.
images:
- url: https://s21.ax1x.com/2020/02/08/1RsSc8.jpg
description: |
<p>Lovely flat in Paris</p>
- url: https://s21.ax1x.com/2019/12/28/leCoa8.jpg
description: |
<p>Charming apartment near the Seine</p>
- url: https://s21.ax1x.com/2020/02/08/1RsBEd.jpg
description: |
<p>Spacious loft in Paris</p>
- url: https://s21.ax1x.com/2019/12/22/QxRZaF.jpg
description: |
<p>Luxurious penthouse</p>
# 添加更多图片
- Use hexo command to generate as usual.
If you need to display hundreds of images, a large number of static DOM elements may not be the optimal solution. It is recommended to consider dynamic fetching and a backend-supported solution.