Hugo仓库维护与博客更新

如何hugo建站可以参考:

  1. https://www.cnblogs.com/legenddog/p/17632687.html

从github拉取hugo博客仓库,本地部署

配置本地hugo环境

  1. 安装hugo

参考地址:https://gohugo.io/installation/

拉取仓库到本地

直接拉取+clone子模块

1
git clone --recurse-submodules https://github.com/crack-dawn/CTGU-Hugo-Blog.io.git

忘记拉取子模块,可以进行

1
2
3
cd CTGU-Hugo-Blog.io
git submodule init
git submodule update --recursive

Vscode作为编辑器,配置hugo任务

 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// https://code.visualstudio.com/docs/editor/tasks-appendix
{
    "version": "2.0.0",
    "presentation": {
        "echo": true,
        "reveal": "always",
        "focus": false,
        "panel": "new",
        "showReuseMessage": true,
        "clear": true
    },
    "options": {
        "cwd": "${workspaceFolder}",//默认进入到 hugo项目根目录
    },
    "problemMatcher": [],

    "tasks": [
        {//
            "type": "shell",
            "label": "1.hugo serve(本地构建测试)",
            "command": "hugo serve -D -e production --gc",
            "isBackground": true,
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {//
            "label": "2.open browser(打开本地浏览器)",
            "type": "shell",
            "windows":{
                "command": "start http://localhost:1313/CTGU-Hugo-Blog.io/",
            },
            "linux":{
                "command": "xdg-open http://localhost:1313/CTGU-Hugo-Blog.io/",
            },
            "osx":{
                "command": "open http://localhost:1313/CTGU-Hugo-Blog.io/",
            },
        },
        {//
            "label": "hugo new file(新建博客文件)",
            "type": "shell",
            "command":"hugo new ./content/posts/${input:newFileName}"
        },
        {
            "label": "3.open Document folder(打开./content/posts文件夹)",
            "type": "shell",
            "command": "code --goto ${workspaceFolder}/content/posts",
        }
    ],

    "inputs": [
        {
        "id": "newFileName",
        "type": "promptString",
        "default": "*.md",
        "description": "输入要创建的文件名"
        }
    ],
}
Thank for your reading~(just额,reward for FixIt auther)
支付宝支付宝
微信微信
0%