主页
文章
分类
系列
标签
关于
创建新的页面
发布于: 2023-4-18   更新于: 2023-4-18   未收录
文章字数: 562   阅读时间: 2 分钟   阅读量:

新增系列分类页面或者创建一个新的页面。

新增系列分类页面

NewBee 默认有“分类”和“标签”两种分类的的方法,除此之外,你还可以创建一个叫做“系列”的分类法。只需编辑配置文件hugo.toml就行:

  1. 编辑[taxonomies]:
1
2
3
4
5
[taxonomies]
    category = "categories"
    tag = "tags"
    # new!
    series = "series"
  1. 编辑[menus],多语言则在其对应的地方编辑即可:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
[menus]
  # new!
  [menus.main]
    # 名称,显示在页面上的
    name = "系列"
    # 路径,和[taxonomies]里的参数值要一样
    url = "/series"
    # 权重
    weight = 4
    # 图标
    pre = "<i class='fa fa-gears'></i>"
  1. 自定义一些参数
1
2
3
4
5
[params]
  [params.page]
    # new!
    seriesTopImg = "/images/series.jpg" # 顶部图片
    seriesDes = "description of series page" # 描述

创建新页面

以新增说说页面为例:

  1. 编辑[taxonomies]:
1
2
3
4
5
[taxonomies]
    category = "categories"
    tag = "tags"
    # new!
    shuoshuo = "shuoshuo"
  1. 编辑[menus] (多语言则在其对应的地方编辑即可):
1
2
3
4
5
6
7
[menus]
  # new!
  [menus.main]
    name = "说说"
    url = "/shuoshuo"
    weight = 4
    pre = "<i class='fa fa-gears'></i>"
  1. 新建相应的html文件

layout文件夹下新建shuoshuo/taxonomy.html, 然后加入以下代码并编辑:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
{{ define "main" }}
<div class="zhuti-0">
    <div class="container">
        <div class="zhuti">
          <!-- 1. 如果是包含在主题左栏里的页面, 在zhuti-l中插入自己的代码 -->
          <div class="zhuti-l">
            你的代码
          </div>
          <div class="zhuti-r">
              {{ partial "widgets/zhuti-r.html" . }}
          </div>
          <!-- 1. end -->
          
          <!-- 2. 否则就不要zhuti-l和zhuti-r, 直接插入代码 -->
          你的代码
          <!-- 2. end -->
        </div>
    </div>
</div>
{{ end }}