|
| 1 | +--- |
| 2 | +title: "Blog_setup" |
| 3 | +date: 2022-10-02T21:36:07+08:00 |
| 4 | +draft: false |
| 5 | +--- |
| 6 | + |
| 7 | +# hugo quick start |
| 8 | +跟着 [quick start doc](https://gohugo.io/getting-started/quick-start/) 初始化站点, theme 选择 [hugo-lithium](https://github.com/draveness/hugo-lithium) |
| 9 | + |
| 10 | +# theme config |
| 11 | +替换 config.toml 为主题example site 的config. |
| 12 | +修改如下: |
| 13 | +- 修改posts permlink 为 baseURL/post_name. |
| 14 | +- 修改single page template, 增加 tag 显示区域. |
| 15 | +- 避免 `_index.md` 使用list page 模板渲染. 因为要自定义索引页. |
| 16 | +- 配置 archetype. |
| 17 | +- 配置菜单 |
| 18 | + |
| 19 | +# content organization |
| 20 | +如果需要发表系类文章, 系列名为demo, 陆续发表两篇文章 Go, Java. |
| 21 | +过程如下: |
| 22 | +- `hugo new posts/demo/_index.md`, 作为系列文章首页包含概述和文章索引. 发布后的URL为demo |
| 23 | +- posts 间的引用语法[link](https://gohugobrasil.netlify.app/content-management/cross-references/). |
| 24 | +- `hugo new posts/demo/Java.md`. 发布后的URL为 /java |
| 25 | +- `hugo new posts/demo/Go.md`. 发布后的URL为 /Go |
| 26 | +- 添加菜单 |
| 27 | + ``` |
| 28 | + [[menu.main]] |
| 29 | + name = "demo" |
| 30 | + url = "/pl/" |
| 31 | + ``` |
| 32 | +# deploy |
| 33 | +use github action and github pages. |
| 34 | +action refer this [repo](https://github.com/peaceiris/actions-hugo). |
| 35 | +rename your baseURL in config.toml with the value `https://<USERNAME>.github.io` |
| 36 | +Go to repo settings->pages->source branch drop down, select branch `gh-pages` as page's source. |
| 37 | +After a while, action automation finished successfully, visit your page's address. |
| 38 | + |
| 39 | +# references |
| 40 | +- hugo content organization and how hugo parse posts url. [link1](https://gohugobrasil.netlify.app/content-management/organization/) |
| 41 | +- single page(article) vs list page(_index.md, tag.md, categories.md) and their templates. [link2](https://gohugo.io/templates/introduction/) |
| 42 | +- hugo variables and scope bind. [link3](https://gohugo.io/variables/) |
0 commit comments