前置元数据(Frontmatter)
设置文章的标题、创建日期、描述等。
官方文档:
使用
page
1# content/test/_index.md
2title: "My amazing new section"
3weight: 1
4type: docs
5description: >
6 A special section with a docs layout.
list/section
1# content/news/_index.md
2title: "Latest News"
3linkTitle: "News"
4menu:
5main:
6 weight: 30
7cascade:
8 - type: "blog"
1# content/sections01/_index.md
2
3# section 子文章"块"显示
4simple_list: true # 列表显示
5no_list: true # 不显示
链接 linking
ref
—— 绝对路径relref
—— 相对路径
1# hostname=localhost
2# port=1313
3# baseurl=/
4.
5└── content
6 ├── document1.md
7 ├── about
8 | ├── _index.md
9 | └── document1.md
10 ├── pages
11 | ├── current.md <----------- current
12 | ├── document1.md
13 | └── document2.md // has anchor #anchor
14 ├── products
15 | └── index.md
16 └── blog
17 └── my-post.md
18
19e.g.
20{{< relref "document1.md" >}} --> 可以忽略后缀
21{{< relref "document1" >}} --> 输出: /content/pages/document/
22{{< ref "document1" >}} --> 输出: //localhost:1313/content/pages/document/
23{{< ref "document2.md#anchor" >}}
24{{< ref "document1" >}} --> 找到: /content/pages/document1.md
25{{< ref "/document1" >}} --> 找到: /content/document1.md
26{{< ref "/about/document1" >}} --> 找到: /content/aboug/document1.md
路径不需要绝对"准确",hugo会(按照优先级)自动匹配最适合的结果。
优先级:
./*
./**
content/*
content/**
Last modified November 4, 2023: Correcting content dir (da1a055)