Hugo快速起步
在完成 Hugo安装 后,可以快速使用Hugo构建一个网站
创建
docs.cloud-atlas.io
网站hugo new site docs.cloud-atlas.io
此时提示如下:
创建
docs.cloud-atlas.io
网站输出信息Congratulations! Your new Hugo site was created in /Users/huatai/docs/github/huataihuang/docs.cloud-atlas.io.
Just a few more steps...
1. Change the current directory to /Users/huatai/docs/github/huataihuang/docs.cloud-atlas.io.
2. Create or install a theme:
- Create a new theme with the command "hugo new theme <THEMENAME>"
- Or, install a theme from https://themes.gohugo.io/
3. Edit hugo.toml, setting the "theme" property to the theme name.
4. Create new content with the command "hugo new content <SECTIONNAME>/<FILENAME>.<FORMAT>".
5. Start the embedded web server with the command "hugo server --buildDrafts".
See documentation at https://gohugo.io/.
Themes
在 Hugo Themes 找到心仪的Theme
将下载的
hugo-geekdoc.tar.gz
存放到themes
目录下创建的Geekdoc
目录中
安装Geekdoc theme
# 在 themes目录下创建
mkdir themes/Geekdoc
cd themes/Geekdoc
cp ~/Downloads/hugo-geekdoc.tar.gz ./
tar xf hugo-geekdoc.tar.gz
在
docs.cloud-atlas.io
项目根目录下的hugo.toml
中添加一行theme
配置,并相应编辑对应配置,类似如下:
hugo.toml
baseURL = 'https://docs.cloud-atlas.io/'
languageCode = 'en-us'
title = 'Cloud Atlas Docs'
theme = 'Geekdoc'
运行
执行以下命令启动hugo的web服务:
启动hugo server
hugo server -D
撰写文档
撰写一个页面内容:
发布一个页面
hugo new content content/posts/my-first-post.md
发布网站
发布网站
hugo && rsync -avz --delete public/ bcloud-w1-r:/var/web/cloud-atlas.io/docs/
目前看到的是一个基础的页面,没有内容: