安装要求

在开始之前,你需要安装以下软件:

步骤

初始化新的站点

BASH
1hugo new site my-site --format=yaml
点击展开查看更多

通过 Hugo 模块引入主题

BASH
1# 初始化Hugo模块
2cd my-site
3hugo mod init github.com/username/my-site
4
5# 添加 Hugo Narrow 主题
6hugo mod get github.com/tom2almighty/hugo-narrow
点击展开查看更多

复制示例站点配置

hugo-narrow/exampleSite/ 下的内容复制到站点根目录下。这种方式在 ~/themes/ 目录下不会创建文件,访问主题仓库 查看文件。

修改 hugo-narrow/config/_default/hugo.yaml 配置文件,通过模块引入主题:

BASH
1module:
2  hugoVersion:
3    extended: true
4    min: 0.146.0
5  imports:
6    - path: github.com/tom2almighty/hugo-narrow
点击展开查看更多

本地预览

BASH
1hugo server --buildDrafts --disableFastRender
点击展开查看更多

访问 http://localhost:1313 查看预览站点。

更新主题

更新仓库中所有的模块,使用下面的命令:

BASH
1hugo mod get -u
点击展开查看更多

更新主题模块使用下面的命令:

BASH
1hugo mod get -u github.com/tom2almighty/hugo-narrow
点击展开查看更多

版权声明

作者: Hugo Narrow

链接: https://hugo-narrow-docs.vercel.app/zh-cn/docs/hugo-mod/

许可证: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Please attribute the source, use non-commercially, and maintain the same license.

开始搜索

输入关键词搜索文章内容

↑↓
ESC
⌘K 快捷键