前端字段实例页 | chengicli

前端字段实例页

这个页面本身就是一组字段实例

对照一下你现在看到的界面,这些效果全是文件头里那几行控制的:

你看到的对应字段值
右侧栏没了,页面占满宽度asidefalse
背后是深蓝渐变,不是默认壁纸background一段 CSS 渐变
顶部没有大图,只有一行标题top_imgfalse
文末没有版权与许可那一块copyrightfalse
文末没有评论区commentsfalse
这一页的文字可以随便选中复制selectabletrue

注意一件事:右侧的目录也一起没了。目录(toc)在主题里是挂在侧栏上的一个挂件,所以 aside: false 会连它一起关掉——这一页即使写了 toc: true 也不会出现目录。文章页要目录,需三者同时成立:侧栏开启、page.toc 为真、正文有标题。

这份文件头长这样

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
---
title: 前端字段实例页
date: 2026-11-07 15:30:00
updated: 2026-11-07 15:35:00
description: 演示 front-matter 里页面级字段的实际效果。
keywords: Hexo, front-matter, 示例
aside: false
background: linear-gradient(160deg, #1b2735 0%, #0d1420 55%, #16283a 100%)
top_img: false
copyright: false
license: CC BY-NC-SA 4.0
license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/
toc: true
toc_number: true
toc_expand: false
toc_style_simple: true
comments: false
nofollow: true
---

再看一个跳转页

另一个示例:跳转页。它只有两行文件头,靠 type: redirect 触发跳转:

1
2
3
4
5
6
---
title: 跳转示例
type: redirect
redirect_to: /demo/front-matter/
redirect_tip: 这是跳转示例页,正在前往「前端字段实例页」。
---

访问 /demo/redirect/ 就能看到效果:页面会提示一句,然后自动跳到本页。

空降评论复制本文地址
随便逛逛昼夜切换关于博客美化设置切换全屏打印页面