Feiyang Wu

Feiyang Wu

Be Brave and be Happy

网站维护

1. 如何发布一篇新的帖子

以要新发布一篇名为maintain.md的帖子为例:

1
hugo new content /posts/maintain.md

该文件会被加入content/posts文件夹中。新的网页文件会被渲染。

通过修改参数可以更改网页配置,具体信息查阅FixIt文档。

 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
32
33
34
35
36
37
38
39
40
41
---
title: 网站维护
subtitle: 介绍维护该网站的常用方法
date: 2024-05-14T20:58:28-05:00
slug: b7b4b1f
draft: true
author:
name: Feiyang Wu
link:
email:
avatar: /avatar_img/avatar.jpg
description:
keywords:
license:
comment: false
weight: 0
tags:
- 网站维护
categories:
- 网站维护
hiddenFromHomePage: false
hiddenFromSearch: false
hiddenFromRss: false
hiddenFromRelated: false
summary:
resources:
- name: featured-image
src: featured-image.jpg
- name: featured-image-preview
src: featured-image-preview.jpg
toc: true
math: false
lightgallery: false
password:
message:
repost:
enable: true
url:

# See details front matter: https://fixit.lruihao.cn/documentation/content-management/introduction/#front-matter
---

以上是本页面的配置信息。如果要渲染该页面,需要将draft值从默认的true改为false

2. 添加菜单内容

找到hugo设置文件hugo.toml,加入菜单设置:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[menu]
    [[menu.main]]
        identifier = "archives"
        parent = ""
        # you can add extra information before the name (HTML format is supported), such as icons
        pre = ""
        # you can add extra information after the name (HTML format is supported), such as icons
        post = ""
        name = "Archives"
        url = "/archives/"
        # title will be shown when you hover on this menu link
        title = ""
        weight = 1
        # FixIt 0.2.14 | NEW add user-defined content to menu items
        [menu.main.params]
            # add css class to a specific menu item
            class = ""
            # whether set as a draft menu item whose function is similar to a draft post/page
            draft = false
            # FixIt 0.2.16 | NEW add fontawesome icon to a specific menu item
            icon = "fa-solid fa-archive"
            # FixIt 0.2.16 | NEW set menu item type, optional values: ["mobile", "desktop"]
        type = ""

具体用法详见FixIt文档。

3. 添加静态页面

做法类似添加一个新帖子。直接将markdowm文件加入content文件夹即可:

1
hugo new content mian.md

如果该页面无法通过菜单直接找到,可以在markdown最开始的配置区域加上url,例如:

1
2
3
4
5
6
7
+++
title = 'RoboMaster Meta战队'
subtitle = '2024电控教学主页'
date = 2024-05-14T14:17:45-05:00
draft = false
url = '/meta-teaching/main'
+++

该静态页面就会显示在网站/meta-teaching/main页面。

4. 添加图片和资源

将所有的图片和资源放入assets文件夹。资源和文件将以该文件夹为根目录进行寻址。

5. 更多其他功能

更多其他功能请查阅FixIt文档。本文档仅介绍基础维护方法。


0%