使用hugo 搭建一个多语言文档站

mdbook

#本文迁移到

新地址

#使用hugo 搭建一个多语言文档站

请先查看文档
在github上快速部署一个基于hugo的个人博客

hugo new site doc
cd doc
ls
找一个自己喜欢的主题 https://dev.leiyanhui.com/

选中了 这个 https://github.com/thegeeklab/hugo-geekdoc

mkdir -p themes/hugo-geekdoc/
curl -L https://github.com/thegeeklab/hugo-geekdoc/releases/latest/download/hugo-geekdoc.tar.gz | tar -xz -C themes/hugo-geekdoc/ --strip-components=1

rm -rf config.toml

创建文件 nano config.toml
按照官方提示 https://geekdocs.de/usage/getting-started/
输入

plaintext
baseURL = "http://localhost"
title = "Geekdocs"
theme = "hugo-geekdoc"

pluralizeListTitles = false

# Geekdoc required configuration
pygmentsUseClasses = true
pygmentsCodeFences = true
disablePathToLower = true

# Required if you want to render robots.txt template
enableRobotsTXT = true

# Needed for mermaid shortcodes
[markup]
  [markup.goldmark.renderer]
    # Needed for mermaid shortcode
    unsafe = true
  [markup.tableOfContents]
    startLevel = 1
    endLevel = 9

[taxonomies]
   tag = "tags"

本地先测试
hugo server 可以运行了,剩下的不管直接推送到github上
新建一个公开库 https://github.com/joyanhui/doc-hugo 稍后设置为私有
git init
git add -A
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/joyanhui/doc-hugo.git
git push -u origin main

在线编辑 config.toml 把里面的域名 修改成

plaintext
http://joyanhui.github.io/doc-hugo/

在github 设置的 pages打开,定位到gh-pages分支不用绑定域名

新建一个md文件 content/test.md
内容

plaintext
---
title: '测试md'
date: 2022-10-22
tag:
  - test
  - hugo
---
# 测试md 
测试一下

等待actions执行完成后直接打开域名测试 https://joyanhui.github.io/doc-hugo/test/ 已经可以看到
在github上创建文件 .github/workflows/gh-pages.yml 内容参考在github上快速部署一个基于hugo的个人博客

评论