Skip to content

Latest commit

 

History

History
114 lines (87 loc) · 2.48 KB

File metadata and controls

114 lines (87 loc) · 2.48 KB
title description date draft noindex featured pinned nav_weight nav_icon series categories tags images authors
从头开始安装
从头开始使用 HB 卡主题构建快速、响应式和模块化静态网站。
2023-12-02 11:47:31 +0800
false
false
true
true
1
vendor name color
bootstrap
cloud-download
green
文档
安装
HB
HugoMods

我们提供了一个示例站点以方便你快速入门该主题。

{{< bs/alert danger >}} {{< markdownify >}} 请于 PowerShell 或者 Linux 终端运行以下命令,如 WSL 或 Git Bash。 {{< /markdownify >}} {{< /bs/alert >}}

环境要求

  • Go
  • Hugo 扩展版
  • Node.js 16 或更高版本

了解更多关于先决条件的内容。

克隆仓库

git clone --depth 1 https://github.com/hbstack/theme-cards

复制示例站点

cp -r theme-cards/exampleSite mysite

更改工作目录

cd mysite

调整 go.mod

{{< bs/alert >}} {{< markdownify >}} 本文利用 sed 命令进行文件编辑,请随意使用你喜欢的编辑器打开和修改 go.mod。 {{< /markdownify >}} {{< /bs/alert >}}

替换模块路径

模块路径是站点的标识,其一般为仓库 URL,这里以 github.com/user/repo 为例,则需要将 module github.com/hbstack/theme-cards/exampleSite 替换为 module github.com/user/repo

sed -i '1s/.*/module github.com\/user\/repo/' go.mod

删除 replace 指令

为了成功地构建站点,需要删除该内部使用的 replace 指令行:replace github.com/hbstack/theme-cards => ../

sed -i '/^replace/d' go.mod

安装依赖

npm ci

Hugo 模块代理(可选)

当你的所在地区(比如国内)无法访问默认的代理时,则需要设置Hugo 模块代理

本地预览

npm run dev

接下来做什么?

  1. 调整配置,如 baseURLgiscus.* 等。
  2. 删除测试内容。
  3. 阅读文档
  4. 找寻更多模块