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 |
|
|
|
|
我们提供了一个示例站点以方便你快速入门该主题。
{{< 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
{{< 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 github.com/hbstack/theme-cards => ../
。
sed -i '/^replace/d' go.mod
npm ci
当你的所在地区(比如国内)无法访问默认的代理时,则需要设置Hugo 模块代理。
npm run dev