展示你的工作

发布: (2026年2月16日 GMT+8 02:08)
2 分钟阅读
原文: Dev.to

Source: Dev.to

配置站点

diff --git a/site/hugo.toml b/site/hugo.toml
index 4dba0ec..7d59855 100644
--- a/site/hugo.toml
+++ b/site/hugo.toml
@@ -1,6 +1,6 @@
-baseURL = 'https://example.org/'
+baseURL = 'https://imomaliev.com/'
 languageCode = 'en-us'
-title = 'My New Hugo Site'
+title = 'Blog'

 [module]
   replacements = 'github.com/imomaliev/blog/theme -> ../../theme'

按照 Host on GitHub Pages 指南的所有步骤操作。

更新工作流以在 site 目录中构建并发布

diff --git a/.github/workflows/hugo.yaml b/.github/workflows/hugo.yaml
index 20e1d20..d8cc26d 100644
--- a/.github/workflows/hugo.yaml
+++ b/.github/workflows/hugo.yaml
@@ -74,6 +74,7 @@ jobs:
             hugo-
       - name: Build the site
         run: |
+          cd site/
           hugo \
             --gc \
             --minify \
@@ -88,7 +89,7 @@ jobs:
       - name: Upload artifact
         uses: actions/upload-pages-artifact@v4
         with:
-          path: ./public
+          path: ./site/public
   deploy:
     environment:
       name: github-pages

配置自定义域名

我们将通过 GitHub Actions 发布站点,因此可以跳过第 4 步中设置 CNAME 的操作。在第 5 步中设置 AAAA 记录,并使用 GitHub 验证域名。

我们已经上线!

标题灵感来源于同名书籍。

0 浏览
Back to Blog

相关文章

阅读更多 »