本站更新日志页面配置

内容转载自煮雪话河山

最近在迁移博客时,发现当时对博客的很多配置都记不清了,于是萌生了记录折腾网站的日志,本篇主要记录本站更新日志页面的创建及配置。

1.配置文件

_config.anzhiyu.yml 下的 menu: 添加 日志: /update/ || xxx , xxx 为你所想添加的图标,也可去掉。

1
2
menu:
日志: /update/ || anzhiyu-icon-bolt

2.Pug 文件修改

themes/anzhiyu/layout/page.pug 中添加以下内容

1
2
when 'update'
include includes/page/update.pug

注意,Pug 文件的缩进十分严格,在 Pug 中,缩进用于表示层级结构。


3.添加 update.pug 文件

themes/anzhiyu/layout/includes/page 下新建 update.pug 文件,并添加以下内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#update
if site.data.update
each i in site.data.update
.author-content.author-content-item.UpdatePage.single(style = `background: url(${i.top_background}) left 37% / cover no-repeat !important;`)
.card-content
.author-content-item-tips=i.class_name
span.author-content-item-title=i.description
.content-bottom
.tips=i.tip
.banner-button-group
a.banner-button(href=i.buttonLink)
i.anzhiyufont.anzhiyu-icon-arrow-circle-right(style='font-size: 1.3rem')
span.banner-button-text=i.buttonText

#article-container
!= page.content

4.添加 update.yml 文件

source/_data 下新建 update.yml 文件,并添加以下内容:

1
2
3
4
5
6
- top_background: "https://xxxxxx.png"
class_name: "Update Class 1"
description: "Description of the first update"
tip: "Tip for the first update"
buttonLink: "http://link_to_update1.com"
buttonText: "More"

如果不想要页面上方图片,将此文件中的内容全部注释即可


5.新建 Update 页面

使用 Hexo new page update 命令新建页面,并在 Front-matter 中添加 type: update


6.添加日志信息

此时已经完成了 本站更新日志页面 的创建,如果需要添加内容,只需在 update 文件目录下的 index.md 中添加即可,页面支持 Markdown 格式,同时也支持 anzhiyu 主题下的外挂标签。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
---
title: 本站更新日志
date: 2025-01-08 00:00:00
type: update
comments: false
aside: false
top_img: false
---

{% tip home %}本站日记是后面建的,前面有些时间对不上可能{% endtip %}

{% timeline 2025 %}

<!-- timeline 01-08 -->
添加本站更新日志页面
<!-- endtimeline -->

<!-- timeline 01-07 -->
将本站由 GitHub Pages 迁移至 Cloudflare Pages
<!-- endtimeline -->

{% endtimeline %}


{% timeline 2024 %}

<!-- timeline 12-17 -->
使用 Hexo 及安知鱼主题,在 GitHub Pages 搭建本站
<!-- endtimeline -->

{% endtimeline %}