如果你安装了以前的版本的go,下载最新版,解压即可完成升级。
as3:~# wget https://go.googlecode.com/files/go1.2.1.linux-386.tar.gz
as3:~# tar zxvf go1.2.1.linux-386.tar.gz
as3:~# go version
显示:
go version go1.2.1 linux/386
as3:~# cd mygo
as3:~/mygo# go get github.com/spf13/hugo
To build the standard edition:
go install github.com/gohugoio/hugo@latest
To build the extended edition:
CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@latest
参见:https://gohugo.io/installation/
https://gohugo.io/installation/windows/
https://gohugo.io/functions/css/sass/#dart-sass )
as3:~/mygo# cd src/github.com/spf13/hugo/examples/multilingual/
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual# ls
config.yaml content layouts static
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual# hugo --source=. --destination=export (这个就是生成/更新静态网站的命令)
(不过这个版本的hugo是v0.9版,有bug.建议改用下面的用粉红字体写的所安装的v0.10版。那是可执行版,直接就可以运行。)
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual# ls
config.yaml content export layouts static
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual#
(新出现了export目录)
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual# cd export
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual/export# ls
about index.en.html minust news.html uudis
about.html kodu minust.html static uudised
index.en kodu.html news story uudised.html
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual/export#
(~/mygo/src/github.com/spf13/hugo/examples/multilingual/export/里有index.en.html,可见
~/mygo/src/github.com/spf13/hugo/examples/multilingual/export/就是静态网站的根目录。)
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual/export# nohup Rwebserver 29837 > /dev/null &
(访问http://as3.brite.biz:29837/index.en.html就可看到网站效果。)
发贴方法:
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual/export# cd ..
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual# ls
config.yaml content export layouts static
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual# cd content
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual/content# ls
about.en.md about.et.md index.en.md index.et.md story uudis
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual/content# mv index.en.md index.md
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual/content# nano test1.md
按about.en.md的内容格式,新建帖子test1.md,格式如下:
---
title: "test1"
linktitle: "test1"
url: /test1/
lang: "en"
menu: ["en"]
menu_weight: 30
---
这是测试1.
再来一个帖子的示例:
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual/content# cat test2.md
---
title: "测试2"
linktitle: "测试2"
url: /test2/
lang: "en"
menu: ["en"]
menu_weight: 30
---
这是测试2.
然后,
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual/content# cd ..
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual# ls
config.yaml content export layouts static
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual# hugo --source=. --destination=export (这个就是生成/更新静态网站的命令)
演示站点:http://as3.brite.biz:29837,http://hg.bright.za.net
注意:需做如下操作,否则直接访问 绑定的域名地址,是打不开里面的帖子的!会显示
Forbidden.
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual# chown -R www-data.www-data ~/mygo/src/github.com/spf13/hugo/examples/multilingual/
(如果运行 chown -R www-data.www-data ~/mygo/src/github.com/spf13/hugo/examples/multilingual/export/ 无效,就如上对 export的上层目录进行操作。)
as3:~/mygo/src/github.com/spf13/hugo/examples/multilingual#
项目地址:https://github.com/spf13/hugo
以上的示例站点太简陋了,我们可以克隆作者的网站来使用。
wget https://github.com/spf13/hugo/releases/download/v0.10/hugo_0.10_linux_386.tar.gz
tar zxvf hugo_0.10_linux_386.tar.gz
cd hugo_0.10_linux_386
as3:~/hugo_0.10_linux_386# ls
hugo_0.10_linux_386 LICENSE.md README.md
as3:~/hugo_0.10_linux_386#
(hugo_0.10_linux_386就是hugo0.10版的执行文件。)
as3:~/hugo_0.10_linux_386# ln -s ~/hugo_0.10_linux_386/hugo_0.10_linux_386 /usr/local/bin/hugo_0.10
as3:~/hugo_0.10_linux_386# hugo_0.10 version
显示:
Hugo Static Site Generator v0.10
as3:~/hugo_0.10_linux_386# cd ~/mygo/src/github.com/spf13/hugo/examples/
as3:~/mygo/src/github.com/spf13/hugo/examples# git clone https://github.com/spf13/spf13.com
as3:~/mygo/src/github.com/spf13/hugo/examples# cd spf13.com
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com# ls
config.json config.yaml layouts static
config.toml content README.md
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com# hugo_0.10 --source=. --destination=export --base-url=http://as3.brite.biz:32183/ --config=config.json
( 这个就是生成/更新静态网站的命令.如果你绑定了域名,则--base-url的值改为你的域名地址,比如我的为http://hg2.bright.za.net/)
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com# ls
config.json config.yaml export README.md
config.toml content layouts static
(新出现了export目录)
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com# ls export
apple-touch-icon.png index.html media presentation static topics
favicon.ico index.xml post project tags
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com# cd export
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com/export# ls
apple-touch-icon.png index.html media presentation static topics
favicon.ico index.xml post project tags
(可见~/mygo/src/github.com/spf13/hugo/examples/spf13.com/export/就是静态网站的根目录)
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com/export# nohup Rwebserver 32183 > /dev/null &
访问http://as3.brite.biz:32183/就可看到网站效果。
发贴方法:
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com/export# cd ..
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com# ls
config.json config.yaml export README.md
config.toml content layouts static
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com# cd content
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com/content# ls
post presentation project
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com/content# cd post
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com/content/post# nano test1.md
格式如下:
{
"Title": "测试1",
"Description": "click the title to read full article.",
"Tags": [
"misc1",
"misc2",
"misc3"
],
"Pubdate": "2014-03-11T23:46:00-08:00"
}
这是测试1.
然后,
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com/content/post# cd ~/mygo/src/github.com/spf13/hugo/examples/spf13.com
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com# ls
config.json config.yaml export README.md
config.toml content layouts static
as3:~/mygo/src/github.com/spf13/hugo/examples/spf13.com# hugo_0.10 --source=. --destination=export --base-url=http://as3.brite.biz:32183/ --config=config.json
(这个就是生成/更新静态网站的命令.如果你绑定了域名,则--base-url的值改为你的域名地址,比如我的为http://hg2.bright.za.net/)
演示站点:http://as3.brite.biz:32183,http://hg2.bright.za.net
项目地址:https://github.com/spf13/spf13.com, https://gohugo.io
https://github.com/spf13/spf13.com/issues/1
https://github.com/spf13/hugo/releases
https://github.com/spf13/hugo/releases/tag/v0.10
其他示范网站的源码:
https://github.com/hugoduncan/hugoduncan.github.com/tree/develop (搭建的站点:
http://hugoduncan.org/)
https://github.com/chimera/chimeraarts.org (搭建的站点:http://chimeraarts.org/)
https://github.com/philips/www.ifup.org (搭建的站点:http://www.ifup.org/)
https://gitlab.com/acodispo/andrewcodispoti-com (搭建的站点:http://andrewcodispoti.com/)
http://github.com/antzucaro/az.com (搭建的站点:http://antzucaro.com/)
http://github.com/kjhealy/kieranhealy.hugo (搭建的站点:http://kieranhealy.org/)
http://github.com/spf13/hugo/docs (我搭建的站点:http://as3.brite.biz:35414/overview)
http://github.com/spf13/spf13.com (我搭建的站点:http://hg2.bright.za.net)
from http://hugo.spf13.com/showcase
-------------
2017-04-15日更新:
先按照此文http://briteming.blogspot.com/2017/03/gosimple-website.html的红色文字部分,搭建go环境。
cd /usr/local/go/gopath
go get github.com/spf13/hugo
所生成的可执行文件hugo将出现在/usr/local/go/bin/里面.
cd /usr/local/
git clone https://github.com/spf13/hugo hugo-site
cd hugo-site
cd examples
root@localhost:/usr/local/hugo-site/examples# ls
blog multilingual
root@localhost:/usr/local/hugo-site/examples# cd blog
root@localhost:/usr/local/hugo-site/examples/blog# ls
config.toml content layouts README.md static
root@localhost:/usr/local/hugo-site/examples/blog# nano config.toml
(把baseURL的值改为"/")
root@localhost:/usr/local/hugo-site/examples/blog# hugo --source=. --destination=export
(此即生成/更新静态网站的根目录的命令,会在当前目录下生成export目录)
root@localhost:/usr/local/hugo-site/examples/blog# ls
config.toml content export layouts README.md static
root@localhost:/usr/local/hugo-site/examples/blog# cd export
root@localhost:/usr/local/hugo-site/examples/blog/export# ls
categories css fonts index.html index.xml js post sitemap.xml tags
root@localhost:/usr/local/hugo-site/examples/blog/export#
(可见/usr/local/hugo-site/examples/blog/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/blog/export# cd ..
root@localhost:/usr/local/hugo-site/examples/blog#
root@localhost:/usr/local/hugo-site/examples/blog# ls
config.toml content export layouts README.md static
root@localhost:/usr/local/hugo-site/examples/blog# cd content
root@localhost:/usr/local/hugo-site/examples/blog/content# ls
post
root@localhost:/usr/local/hugo-site/examples/blog/content# cd post
root@localhost:/usr/local/hugo-site/examples/blog/content/post# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/blog/content/post# cat test-1.md
---
title: "测试1"
description: 点击标题,看全文
date: 2017-04-14T23:28:00
categories:
- misc1
- misc2
---
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/blog/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/blog# hugo --source=. --destination=export
演示网站:http://hg.bright.biz.st/
项目地址:https://github.com/spf13/hugo
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples
root@localhost:/usr/local/hugo-site/examples# git clone https://github.com/esaezgil/esaezgil.github.io --branch source
root@localhost:/usr/local/hugo-site/examples# cd esaezgil.github.io
root@localhost:/usr/local/hugo-site/examples/esaezgil.github.io# nano config.toml
(把baseurl的值修改为"/")
root@localhost:/usr/local/hugo-site/examples/esaezgil.github.io# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/esaezgil.github.io# ls
config.toml export page README.md themes
content layouts public static wercker.yml
root@localhost:/usr/local/hugo-site/examples/esaezgil.github.io# cd export
root@localhost:/usr/local/hugo-site/examples/esaezgil.github.io/export# ls
404.html CNAME events index.html js post tags
categories css img index.xml page sitemap.xml
root@localhost:/usr/local/hugo-site/examples/esaezgil.github.io/export#
(可见/usr/local/hugo-site/examples/esaezgil.github.io/export是静态网站的
根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/esaezgil.github.io/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/esaezgil.github.io/content/post# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/esaezgil.github.io/content/post# cat test-1.md
+++
title = "测试1"
subtitle = ""
date = "2017-04-15T20:15:33+01:00"
bigimg = ""
+++
这是测试1.
<!--more-->
看看如何?
root@localhost:/usr/local/hugo-site/examples/esaezgil.github.io/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/esaezgil.github.io# hugo --source=. --destination=export
演示网站:http://esgi.bright.biz.st/
项目地址:https://github.com/esaezgil/esaezgil.github.io/tree/source
(支持分页)
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples
git clone https://github.com/alanorth/picturingjordan.com
cd picturingjordan.com
mkdir themes
cd themes
git clone https://github.com/alanorth/hugo-theme-bootstrap4-blog
cd ..
root@localhost:/usr/local/hugo-site/examples/picturingjordan.com# ls
config.toml LICENSE.txt README.md static
content layouts public screenshot.png themes
root@localhost:/usr/local/hugo-site/examples/picturingjordan.com# nano
config.toml
(把baseurl的值修改为"/")
root@localhost:/usr/local/hugo-site/examples/picturingjordan.com# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/picturingjordan.com# ls
config.toml export LICENSE.txt README.md static
content layouts public-old screenshot.png themes
root@localhost:/usr/local/hugo-site/examples/picturingjordan.com# cd export
root@localhost:/usr/local/hugo-site/examples/picturingjordan.com/export# ls
2016 categories js
2017 css manifest.json
404.html en mstile-150x150.png
about favicon-16x16.png page
android-chrome-192x192.png favicon-32x32.png post
android-chrome-512x512.png favicon.ico robots.txt
apple-touch-icon.png fonts safari-pinned-tab.svg
bg index.html sitemap.xml
browserconfig.xml index.xml tags
root@localhost:/usr/local/hugo-site/examples/picturingjordan.com/export#
(可见/usr/local/hugo-site/examples/picturingjordan.com/export就是静态网站的
根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/picturingjordan.com/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/picturingjordan.com/content/post# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/picturingjordan.com/content/post# cat test-1.md
+++
categories = ["misc"]
description = "点击标题,看全文"
date = "2017-04-16T8:37:28+02:00"
title = "测试1"
slug = "test-1"
author = "brite fisherman"
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/picturingjordan.com/content/post#
root@localhost:/usr/local/hugo-site/examples/picturingjordan.com/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/picturingjordan.com# hugo --source=. --destination=export
演示网站:http://pjc.bright.biz.st
项目地址:https://github.com/alanorth/picturingjordan.com
https://github.com/alanorth/hugo-theme-bootstrap4-blog
(支持分页)
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples
git clone https://github.com/shapeshed/shapeshed.com
cd shapeshed.com
mkdir themes
cd themes
git clone https://github.com/shapeshed/shapeshed-minimal
cd ..
root@localhost:/usr/local/hugo-site/examples/shapeshed.com# ls
config.toml content Makefile README.md static themes
root@localhost:/usr/local/hugo-site/examples/shapeshed.com# nano config.toml
(把baseurl的值改为"/")
root@localhost:/usr/local/hugo-site/examples/shapeshed.com# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/shapeshed.com# ls
config.toml content export Makefile README.md static themes
(生成了export目录)
root@localhost:/usr/local/hugo-site/examples/shapeshed.com# cd export
root@localhost:/usr/local/hugo-site/examples/shapeshed.com/export#
(/usr/local/hugo-site/examples/shapeshed.com/export目录含有index.html,所以
/usr/local/hugo-site/examples/shapeshed.com/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/shapeshed.com/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/shapeshed.com/content/post# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/shapeshed.com/content/post# cat test-1.md
---
title: 测试1
slug: test-1
author: brite fisherman
tags: [misc1, misc2, misc3]
description: "点击标题,看全文"
date: 2017-04-16T13:55:00Z
---
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/shapeshed.com/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/shapeshed.com# hugo --source=. --destination=export
演示网站:http://ssc.bright.biz.st/
项目地址:https://github.com/shapeshed/shapeshed.com
https://github.com/shapeshed/shapeshed-minimal
(支持分页)
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples
git clone https://github.com/astrochili/astrochili.github.io --branch hugo
cd astrochili.github.io
root@localhost:/usr/local/hugo-site/examples/astrochili.github.io# ls
prod.toml content data dev.sh dev.toml layouts prod.sh static
root@localhost:/usr/local/hugo-site/examples/astrochili.github.io# mv prod.toml config.toml
root@localhost:/usr/local/hugo-site/examples/astrochili.github.io# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/astrochili.github.io# ls
config.toml content data dev.sh dev.toml export layouts prod.sh static
root@localhost:/usr/local/hugo-site/examples/astrochili.github.io# cd export
root@localhost:/usr/local/hugo-site/examples/astrochili.github.io/export# ls
404.html CNAME front index.xml post sitemap.xml
blog contacts images js projects tags
categories css index.html music README.md thanks
root@localhost:/usr/local/hugo-site/examples/astrochili.github.io/export#
(可见/usr/local/hugo-site/examples/astrochili.github.io/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/astrochili.github.io/export# cd ../content/blog
root@localhost:/usr/local/hugo-site/examples/astrochili.github.io/content/blog# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/astrochili.github.io/content/blog# cat test-1.md
+++
title = "测试1"
date = "2017-04-16T15:20:00"
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/astrochili.github.io/content/blog# cd ../..
root@localhost:/usr/local/hugo-site/examples/astrochili.github.io# hugo --source=. --destination=export
演示网站:http://acl.bright.biz.st,http://acl.bright.biz.st/blog/
项目地址:https://github.com/astrochili/astrochili.github.io/tree/hugo
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/moonytheloony/Blog-Web rahulrai.in
cd rahulrai.in
root@localhost:/usr/local/hugo-site/examples/rahulrai.in# ls
archetypes manifest.json sitesearch.tsv
config.toml media static
content OneSignalSDKUpdaterWorker.js themes
data OneSignalSDKWorker.js travisdeploy.sh
README.md Web.config
gulpfile.js resources
layouts search.xml
root@localhost:/usr/local/hugo-site/examples/rahulrai.in# nano config.toml
(把baseurl的值改为"/" ,把paginate的值改为5
root@localhost:/usr/local/hugo-site/examples/rahulrai.in# hugo --source=. --destination=export
(不过运行此命令会遇错,见https://github.com/moonytheloony/Blog-Web/issues/2,原来是所使用的hugo的版本不对,我现在用的版本是目前的最新版:v0.21-DEV,
root@localhost:/usr/local/hugo-site/examples/rahulrai.in# hugo version
Hugo Static Site Generator v0.21-DEV linux/amd64 BuildDate: 2017-04-14T15:54:45+01:00
root@localhost:/usr/local/hugo-site/examples/rahulrai.in# )
程序作者说要用0.17版:
root@localhost:/usr/local/hugo-site/examples/rahulrai.in# cd ~
root@localhost:~# wget https://github.com/spf13/hugo/releases/download/v0.17/hugo_0.17_Linux-64bit.tar.gz
root@localhost:~# tar zxvf hugo_0.17_Linux-64bit.tar.gz
root@localhost:~# cd hugo_0.17_linux_amd64
root@localhost:~/hugo_0.17_linux_amd64# ls
hugo_0.17_linux_amd64 LICENSE.md README.md
root@localhost:~/hugo_0.17_linux_amd64# ln -s ~/hugo_0.17_linux_amd64/hugo_0.17_linux_amd64 /usr/local/bin/hugo_0.17
root@localhost:~/hugo_0.17_linux_amd64# cd /usr/local/hugo-site/examples/rahulrai.in
root@localhost:/usr/local/hugo-site/examples/rahulrai.in#
root@localhost:/usr/local/hugo-site/examples/rahulrai.in# hugo_0.17 version
Hugo Static Site Generator v0.17 BuildDate: 2016-10-07T15:45:27+01:00
root@localhost:/usr/local/hugo-site/examples/rahulrai.in# hugo_0.17 --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/rahulrai.in# cd export
root@localhost:/usr/local/hugo-site/examples/rahulrai.in/export# ls
404.html contact fonts js post sitemap.xml
archive css index.html other profile tags
categories disclaimer index.xml page search
root@localhost:/usr/local/hugo-site/examples/rahulrai.in/export#
(可见/usr/local/hugo-site/examples/rahulrai.in/export是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/rahulrai.in/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/rahulrai.in/content/post# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/rahulrai.in/content/post# cat test-1.md
+++
author = "brite fisherman"
categories = ["misc1", "misc2", "misc3"]
date = "2017-04-17T19:41:47"
draft = false
title = "测试1"
type = "post"
slug = "test-1"
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/rahulrai.in/content/post#
root@localhost:/usr/local/hugo-site/examples/rahulrai.in/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/rahulrai.in# hugo_0.17 --source=. --destination=export
演示网站:http://rhr.bright.biz.st
项目地址:https://github.com/moonytheloony/Blog-Web/
https://github.com/moonytheloony/Blog-Web/issues/2
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clonehttps://github.com/peterychuang/peterychuang.github.io --branch source
cd peterychuang.github.io
root@localhost:/usr/local/hugo-site/examples/peterychuang.github.io# nano config.yml
(把baseurl的值改为"/")
root@localhost:/usr/local/hugo-site/examples/peterychuang.github.io# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/peterychuang.github.io# cd export
root@localhost:/usr/local/hugo-site/examples/peterychuang.github.io/export# ls
404.html categories index.html novelists-on-everything robots.txt tech
assets CNAME index.xml novels short-stories
blog cookie misc on-writing sitemap.xml
bookshelf essays music poetry tag
root@localhost:/usr/local/hugo-site/examples/peterychuang.github.io/export#
(可见/usr/local/hugo-site/examples/peterychuang.github.io/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/peterychuang.github.io/export# cd ../content
root@localhost:/usr/local/hugo-site/examples/peterychuang.github.io/content# ls
blog essays novelists-on-everything.md poetry tech
bookshelf misc novels short-stories
cookie.md music on-writing tag.md
root@localhost:/usr/local/hugo-site/examples/peterychuang.github.io/content# cd essays
root@localhost:/usr/local/hugo-site/examples/peterychuang.github.io/content/essays# nano
2017-04-16-test-1.md
root@localhost:/usr/local/hugo-site/examples/peterychuang.github.io/content/essays# cat 2017-04-16-test-1.md
---
author: brite fisherman
comments: true
date: 2017-04-16T22:03:59Z
description: 点击标题,看全文
header:
caption: ""
image: shape.jpg
tag:
- misc1
- misc2
- misc3
title: 测试1
type: post
url: /essays/test-1/
---
这是测试1。
看看如何?
root@localhost:/usr/local/hugo-site/examples/peterychuang.github.io/content/essays# cd ../..
root@localhost:/usr/local/hugo-site/examples/peterychuang.github.io# hugo --source=. --destination=export
演示网站:http://pyc.bright.biz.st/,http://pyc.bright.biz.st/blog/
项目地址:https://github.com/peterychuang/peterychuang.github.io/tree/source
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/shelan/my-hugo-site shelan.org
cd shelan.org
root@localhost:/usr/local/hugo-site/examples/shelan.org# ls
config.toml content deploy.sh layouts static themes
root@localhost:/usr/local/hugo-site/examples/shelan.org# nano config.toml
(把baseurl的值改为"/" ,把paginate的值改为5)
root@localhost:/usr/local/hugo-site/examples/shelan.org# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/shelan.org# ls
config.toml content deploy.sh export layouts static themes
root@localhost:/usr/local/hugo-site/examples/shelan.org# cd export
root@localhost:/usr/local/hugo-site/examples/shelan.org/export# ls
blog fonts index.xml page tech
css images js resume.pdf techlife
flink-spark-batch-reports index.html life sitemap.xml
root@localhost:/usr/local/hugo-site/examples/shelan.org/export#
(可见 /usr/local/hugo-site/examples/shelan.org/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/shelan.org/export# cd ../content/life
root@localhost:/usr/local/hugo-site/examples/shelan.org/content/life# nano bilu.md
root@localhost:/usr/local/hugo-site/examples/shelan.org/content/life# cat bilu.md
+++
title = "因为我爱你"
date = 2017-04-18T09:50:00Z
blogimport = true
categories =["life"]
[author]
name = "brite fisherman"
+++
<!--more-->
<iframe width="640" height="360" src="https://www.youtube.com/embed/CbJZglyk-mM" frameborder="0" allowfullscreen></iframe>
root@localhost:/usr/local/hugo-site/examples/shelan.org/content/life# cd ../..
root@localhost:/usr/local/hugo-site/examples/shelan.org# hugo --source=. --destination=export
演示网站:http://slo.bright.biz.st
项目地址:https://github.com/shelan/my-hugo-site
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/igorkulman/coding-journal blog.kulman.sk
cd blog.kulman.sk
root@localhost:/usr/local/hugo-site/examples/blog.kulman.sk# ls
config.toml content layouts README.md static themes
root@localhost:/usr/local/hugo-site/examples/blog.kulman.sk# nano config.toml
(把baseurl的值改为"/" ,把paginate的值改为5)
root@localhost:/usr/local/hugo-site/examples/blog.kulman.sk# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/blog.kulman.sk# cd export
root@localhost:/usr/local/hugo-site/examples/blog.kulman.sk/export#
(/usr/local/hugo-site/examples/blog.kulman.sk/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/blog.kulman.sk/export# cd ../content
root@localhost:/usr/local/hugo-site/examples/blog.kulman.sk/content# ls
about.md post projects
root@localhost:/usr/local/hugo-site/examples/blog.kulman.sk/content# cd post
root@localhost:/usr/local/hugo-site/examples/blog.kulman.sk/content/post# nano 2017-04-18-test-1.md
root@localhost:/usr/local/hugo-site/examples/blog.kulman.sk/content/post# cat 2017-04-18-test-1.md
+++
Categories = ["misc1", "misc2", "misc3"]
Description = "点击标题,看全文"
author = "brite fisherman"
date = "2017-04-18T10:41:12+01:00"
title = "测试1"
url = "/test-1/"
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/blog.kulman.sk/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/blog.kulman.sk# hugo --source=. --destination=export
演示网站:http://bks.bright.biz.st
项目地址:https://github.com/igorkulman/coding-journal
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/TBeijen/tbnl-hugo www.tibobeijen.nl
cd www.tibobeijen.nl
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl# ls
bin config.toml content source static themes
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl# cd themes
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl/themes# ls
hugo-steam-theme
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl/themes# cd hugo-steam-theme
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl/themes/hugo-steam-theme# ls
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl/themes/hugo-steam-theme#
(此时的hugo-steam-theme是个空目录)
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl/themes/hugo-steam-theme# cd ../..
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl# ls -la
total 44
drwxr-xr-x 8 root root 4096 Apr 19 09:11 .
drwx------ 39 root root 4096 Apr 19 09:11 ..
drwxr-xr-x 2 root root 4096 Apr 19 09:11 bin
-rw-r--r-- 1 root root 1810 Apr 19 09:11 config.toml
drwxr-xr-x 4 root root 4096 Apr 19 09:11 content
drwxr-xr-x 8 root root 4096 Apr 19 09:11 .git
-rw-r--r-- 1 root root 8 Apr 19 09:11 .gitignore
-rw-r--r-- 1 root root 176 Apr 19 09:11 .gitmodules
drwxr-xr-x 2 root root 4096 Apr 19 09:11 source
drwxr-xr-x 4 root root 4096 Apr 19 09:11 static
drwxr-xr-x 3 root root 4096 Apr 19 09:11 themes
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl# git submodule update --init --recursive
(此步骤其实是把https://github.com/TBeijen/hugo-steam-theme/tree/14128d00f9817ccad42bce397de3baa62a79f32e的内容克隆到了/usr/local/hugo-site/examples/www.tibobeijen.nl/themes/hugo-steam-theme/里。)
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl# nano config.toml
(把baseURL的值改为"/" ,把paginate的值改为3)
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl# hugo_0.17 --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl# cd export
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl/export# ls
2017 about categories fonts index.html js post tags
404.html blog css img index.xml media sitemap.xml
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl/export#
(可见/usr/local/hugo-site/examples/www.tibobeijen.nl/export是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl/export# cd ..
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl# cd content/post
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl/content/post# nano 2017-04-19-test-1.md
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl/content/post# cat 2017-04-19-test-1.md
---
title: 测试1
author: brite fisherman
date: 2017-04-19T16:40:22+00:00
url: /test-1/
categories:
- misc1
- misc2
- misc3
---
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/www.tibobeijen.nl# hugo_0.17 --source=. --destination=export
演示网站:http://wtn.bright.biz.st, http://wtn.bright.biz.st/post
项目地址: https://github.com/TBeijen/tbnl-hugo
https://github.com/TBeijen/hugo-steam-theme/tree/14128d00f9817ccad42bce397de3baa62a79f32e ,
https://github.com/TBeijen/hugo-steam-theme
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/gilesp/vurtcouk vurt.co.uk
cd vurt.co.uk
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk#
我们访问https://github.com/gilesp/vurtcouk/tree/master/themes,可知ghostwriter是个空目录。
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk# cd themes
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk/themes# ls
ghostwriter strongly_typed vurt
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk/themes# ls ghostwriter
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk/themes#
(说明/usr/local/hugo-site/examples/vurt.co.uk/themes/ghostwriter是个空目录)
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk/themes# rm -rf ghostwriter
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk/themes# git clone https://github.com/jbub/ghostwriter
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk# nano config.toml
(把baseurl的值改为"/")
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk# cd export
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk/export# ls
2005 about ideas index.xml post sitemap.xml test.html
2013 dist images js project styles wp-content
404.html idea index.html page projects tags
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk/export#
(可见/usr/local/hugo-site/examples/vurt.co.uk/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk/content/post# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk/content/post# cat test-1.md
+++
title = "测试1"
tags = ["misc1", "misc2", "misc3"]
date = 2017-04-19T19:11:41Z
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/vurt.co.uk# hugo --source=. --destination=export
演示网站:http://vcu.bright.biz.st/
项目地址:
https://github.com/gilesp/vurtcouk
https://github.com/jbub/ghostwriter
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/mijime/mijime.github.io
cd mijime.github.io
root@localhost:/usr/local/hugo-site/examples/mijime.github.io# ls
circle.yml content layouts postcss.config.js source themes
config.toml Makefile README.md static
root@localhost:/usr/local/hugo-site/examples/mijime.github.io# nano config.toml
(把baseurl的值改为"/")
root@localhost:/usr/local/hugo-site/examples/mijime.github.io#
root@localhost:/usr/local/hugo-site/examples/mijime.github.io# ls -la
total 76
drwxr-xr-x 9 root root 4096 Apr 15 12:32 .
drwxr-xr-x 19 root root 4096 Apr 19 04:30 ..
-rw-r--r-- 1 root root 31 Apr 15 11:33 .babelrc
-rw-r--r-- 1 root root 701 Apr 15 11:33 circle.yml
-rw-r--r-- 1 root root 449 Apr 15 11:47 config.toml
drwxr-xr-x 4 root root 4096 Apr 15 11:33 content
-rw-r--r-- 1 root root 2048 Apr 15 11:33 .eslintrc
drwxr-xr-x 9 root root 4096 Apr 15 12:27 export
drwxr-xr-x 8 root root 4096 Apr 15 11:33 .git
-rw-r--r-- 1 root root 1227 Apr 15 11:33 .gitignore
-rw-r--r-- 1 root root 83 Apr 15 11:33 .gitmodules
drwxr-xr-x 7 root root 4096 Apr 15 11:33 layouts
-rw-r--r-- 1 root root 1866 Apr 15 11:33 Makefile
-rw-r--r-- 1 root root 21 Apr 15 11:33 postcss.config.js
-rw-r--r-- 1 root root 174 Apr 15 11:33 README.md
drwxr-xr-x 5 root root 4096 Apr 15 11:33 source
drwxr-xr-x 4 root root 4096 Apr 15 12:27 static
-rw-r--r-- 1 root root 64 Apr 15 11:33 .textlintrc
drwxr-xr-x 3 root root 4096 Apr 19 14:25 themes
root@localhost:/usr/local/hugo-site/examples/mijime.github.io# git submodule update --init --recursive
(/usr/local/hugo-site/examples/mijime.github.io/themes/hyde/之前是空目录, 现在则包含了一些内容,其实就是克隆了https://github.com/spf13/hyde的内容)
root@localhost:/usr/local/hugo-site/examples/mijime.github.io# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/mijime.github.io# cd export
root@localhost:/usr/local/hugo-site/examples/mijime.github.io/export# ls
404.html css js sitemap.xml
apple-touch-icon-144-precomposed.png favicon.png page slide
categories index.html post tags
circle.yml index.xml robots.txt
root@localhost:/usr/local/hugo-site/examples/mijime.github.io/export#
(可见/usr/local/hugo-site/examples/mijime.github.io/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/mijime.github.io/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/mijime.github.io/content/post#
root@localhost:/usr/local/hugo-site/examples/mijime.github.io/content/post# cat test-again.md
+++
date = "2017-04-20T00:01:24"
draft = false
title = "再次测试"
tags = ["misc1", "misc2", "misc3"]
+++
再次测试。
看看如何?
root@localhost:/usr/local/hugo-site/examples/mijime.github.io/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/mijime.github.io# hugo --source=. --destination=export
演示网站:http://mjm.bright.biz.st/
项目地址:https://github.com/mijime/mijime.github.io/
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/zyro/andreimihu.com
cd andreimihu.com
root@localhost:/usr/local/hugo-site/examples/andreimihu.com# ls
config.toml content README.md static themes
root@localhost:/usr/local/hugo-site/examples/andreimihu.com# cd themes
root@localhost:/usr/local/hugo-site/examples/andreimihu.com/themes# ls
hyde-x
root@localhost:/usr/local/hugo-site/examples/andreimihu.com/themes# ls hyde-x
root@localhost:/usr/local/hugo-site/examples/andreimihu.com/themes# rm -rf hyde-x
root@localhost:/usr/local/hugo-site/examples/andreimihu.com/themes# git clone https://github.com/zyro/hyde-x
root@localhost:/usr/local/hugo-site/examples/andreimihu.com/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/andreimihu.com# nano config.toml
(把baseurl的值改为"/" ,
把paginate的值改为3)
root@localhost:/usr/local/hugo-site/examples/andreimihu.com# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/andreimihu.com# cd export
root@localhost:/usr/local/hugo-site/examples/andreimihu.com/export# ls
404.html categories images js post
about css index.html license sitemap.xml
blog favicon.png index.xml page touch-icon-144-precomposed.png
root@localhost:/usr/local/hugo-site/examples/andreimihu.com/export#
(可见/usr/local/hugo-site/examples/andreimihu.com/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/andreimihu.com/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/andreimihu.com/content/post# nano 2017-05-01-test-1.md
root@localhost:/usr/local/hugo-site/examples/andreimihu.com/content/post# cat 2017-05-01-test-1.md
+++
date = "2017-05-01T17:22:00"
title = "测试1"
description = "点击标题,看全文"
categories = ["misc1", "misc2", "misc3"]
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/andreimihu.com/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/andreimihu.com# hugo --source=. --destination=export
注:在源帖中,如果header部分加了description那一行,则正文里面的截断符<!--more-->不起作用。
如果header部分不加description那一行,则正文里面的截断符<!--more-->才起作用。
演示网站:http://armh.smt.biz.st
项目地址:https://github.com/zyro/andreimihu.com
https://github.com/zyro/hyde-x
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/riboflavin/blog justindunham.net
cd justindunham.net
root@localhost:/usr/local/hugo-site/examples/justindunham.net# ls
archetypes config.toml content static themes
root@localhost:/usr/local/hugo-site/examples/justindunham.net# nano config.toml
(把baseurl的值改为"/" ,在其下一行,加上theme = "jd" )
root@localhost:/usr/local/hugo-site/examples/justindunham.net# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/justindunham.net# cd export
root@localhost:/usr/local/hugo-site/examples/justindunham.net/export#
(/usr/local/hugo-site/examples/justindunham.net/export包含了index.html,可见/usr/local/hugo-site/examples/justindunham.net/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/justindunham.net/export# cd ../content
root@localhost:/usr/local/hugo-site/examples/justindunham.net/content# nano test-1.markdown
root@localhost:/usr/local/hugo-site/examples/justindunham.net/content# cat test-1.markdown
+++
archives = ["blog"]
date = "2017-04-20T09:16:25-05:00"
tags = ["misc1", "misc2", "misc3"]
title = "测试1"
slug = "test-1"
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/justindunham.net/content# cd ..
root@localhost:/usr/local/hugo-site/examples/justindunham.net# hugo --source=. --destination=export
演示网站:http://jdn.bright.biz.st/
项目地址:https://github.com/riboflavin/blog
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/patrickn/neaveynet-hugo neavey.net
cd neavey.net
root@localhost:/usr/local/hugo-site/examples/neavey.net# ls -la
total 60
drwxr-xr-x 9 root root 4096 Apr 20 04:49 .
drwxr-xr-x 21 root root 4096 Apr 20 08:28 ..
-rw-r--r-- 1 root root 2167 Apr 20 05:21 config.toml
drwxr-xr-x 3 root root 4096 Apr 20 04:39 content
drwxr-xr-x 2 root root 4096 Apr 20 04:39 data
drwxr-xr-x 14 root root 4096 Apr 20 04:39 export
drwxr-xr-x 8 root root 4096 Apr 20 04:39 .git
-rw-r--r-- 1 root root 37 Apr 20 04:39 .gitignore
-rw-r--r-- 1 root root 138 Apr 20 04:39 .gitmodules
drwxr-xr-x 4 root root 4096 Apr 20 04:39 layouts
-rw-r--r-- 1 root root 1105 Apr 20 04:39 LICENSE.md
-rw-r--r-- 1 root root 932 Apr 20 04:39 README.md
drwxr-xr-x 6 root root 4096 Apr 20 04:39 static
drwxr-xr-x 3 root root 4096 Apr 20 04:45 themes
-rw-r--r-- 1 root root 423 Apr 20 04:39 .travis.yml
root@localhost:/usr/local/hugo-site/examples/neavey.net# git submodule update --init --recursive
(其实就是在themes目录,克隆https://github.com/digitalcraftsman/hugo-icarus-theme)
root@localhost:/usr/local/hugo-site/examples/neavey.net# nano config.toml
(把baseurl的值改为 "/")
root@localhost:/usr/local/hugo-site/examples/neavey.net# hugo --source=. --destination=export
这其中会遇错,解决办法:
root@localhost:/usr/local/hugo-site/examples/neavey.net# nano content/post/template.md
(把date的值改为"2000-01-01T00:00:00-00:00")
root@localhost:/usr/local/hugo-site/examples/neavey.net# cd content/post/
root@localhost:/usr/local/hugo-site/examples/neavey.net/content/post# nano interlude.md
(每个md文件都要修改:删除layout: post这一行。)
root@localhost:/usr/local/hugo-site/examples/neavey.net/content/post# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/neavey.net/content/post# cat test-1.md
---
title: 测试1
author: brite fisherman
date: 2017-04-21T09:40:41+00:00
categories:
- misc1
- misc2
- misc3
---
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/neavey.net/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/neavey.net# hugo --source=. --destination=export
演示网站:http://nv.bright.biz.st/
项目地址: https://github.com/patrickn/neaveynet-hugo
https://github.com/digitalcraftsman/hugo-icarus-theme
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/shivanshuag/shivanshuag.github.io --branch new
cd shivanshuag.github.io
root@localhost:/usr/local/hugo-site/examples/shivanshuag.github.io# ls
config.toml content export public Readme.md static themes
root@localhost:/usr/local/hugo-site/examples/shivanshuag.github.io# nano config.toml
(把baseurl的值改为"/")
root@localhost:/usr/local/hugo-site/examples/shivanshuag.github.io# hugo_0.17 --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/shivanshuag.github.io# cd export
root@localhost:/usr/local/hugo-site/examples/shivanshuag.github.io/export# ls
404.html CNAME index.html my-way-of-celebrating-holi sitemap.xml
about css index.xml openvpn-mfa tags
books hacking js page thesis
categories images movies shorts top
root@localhost:/usr/local/hugo-site/examples/shivanshuag.github.io/export#
(可见/usr/local/hugo-site/examples/shivanshuag.github.io/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/shivanshuag.github.io/export# cd ../content/top
root@localhost:/usr/local/hugo-site/examples/shivanshuag.github.io/content/top# nano test-again.md
root@localhost:/usr/local/hugo-site/examples/shivanshuag.github.io/content/top# cat test-again.md
+++
Description = ""
Tags = ["misc1", "misc2", "misc3"]
date = "2017-04-21T15:14:54+05:30"
menu = "main"
title = "再次测试"
+++
这是再次测试。
看看如何?
root@localhost:/usr/local/hugo-site/examples/shivanshuag.github.io/content/top# cd ../..
root@localhost:/usr/local/hugo-site/examples/shivanshuag.github.io# hugo_0.17 --source=. --destination=export
演示网站:http://njd.bright.biz.st/
项目地址:https://github.com/shivanshuag/shivanshuag.github.io/tree/new
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/fale/fale.io
cd fale.io
root@localhost:/usr/local/hugo-site/examples/fale.io# ls
archetypes content LICENSE static update_website.sh
config.yaml data layouts README.md themes
root@localhost:/usr/local/hugo-site/examples/fale.io# nano config.yaml
(把baseurl的值改为/)
root@localhost:/usr/local/hugo-site/examples/fale.io# cd themes
root@localhost:/usr/local/hugo-site/examples/fale.io/themes# ls
bootstrap2hugo
root@localhost:/usr/local/hugo-site/examples/fale.io/themes# rm -rf bootstrap2hugo
root@localhost:/usr/local/hugo-site/examples/fale.io/themes# git clone https://github.com/Fale/bootstrap2hugo
root@localhost:/usr/local/hugo-site/examples/fale.io/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/fale.io# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/fale.io# cd export
root@localhost:/usr/local/hugo-site/examples/fale.io/export# ls
about certifications fonts js publication tags
aggregators cookies img locations public_speaking talk
blog css index.html page robots.txt
categories favicon.ico index.xml post sitemap.xml
root@localhost:/usr/local/hugo-site/examples/fale.io/export#
(可见/usr/local/hugo-site/examples/fale.io/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/fale.io/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/fale.io/content/post# nano 2017_04_19_test_1.md
root@localhost:/usr/local/hugo-site/examples/fale.io/content/post# cat 2017_04_19_test_1.md
---
date: 2017-04-19T14:56:00
title: "测试1"
categories:
- misc1
- misc2
- misc3
---
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/fale.io/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/fale.io# hugo --source=. --destination=export
演示网站:http://fli.bright.biz.st
项目地址:https://github.com/Fale/fale.io
https://github.com/Fale/bootstrap2hugo
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clonehttps://github.com/SamuelDebruyn/hugo-theme-example materialexample.sa.muel.be
cd materialexample.sa.muel.be
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be# ls
config.toml content static themes wercker.yml
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be# cd themes
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be/themes# ls
material-lite
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be/themes# ls material-lite
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be/themes# git clone https://github.com/SamuelDebruyn/hugo-material-lite material-lite
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be# nano config.toml
(把baseurl的值改为"/" ,把paginate的值改为3)
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be#
hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be# cd export
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be/export# ls
categories css index.html js post tags
CNAME images index.xml page sitemap.xml
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be/export#
(可见/usr/local/hugo-site/examples/materialexample.sa.muel.be/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be/export# cd ../content
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be/content# ls
page post
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be/content# cd post
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be/content/post# nano test-1.markdown
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be/content/post# cat test-1.markdown
+++
date = "2017-04-21T16:11:59+02:00"
draft = false
title = "测试1"
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/materialexample.sa.muel.be# hugo --source=. --destination=export
演示网站:http://hte.bright.biz.st
项目地址:https://github.com/SamuelDebruyn/hugo-theme-example
https://github.com/SamuelDebruyn/hugo-theme-example/blob/master/.gitmodules
https://github.com/SamuelDebruyn/hugo-material-lite
(相关:
https://github.com/SamuelDebruyn/chipsncookies-site-builder/
https://github.com/SamuelDebruyn/chipsncookies-site-builder/issues/1
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/masa0221/hugo-theme-geppaku hugo-theme-geppaku-site
cd hugo-theme-geppaku-site
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site# mkdir exampleSite/themes
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site# mv archetypes exampleSite/themes
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site# mv images exampleSite/themes
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site# mv layouts exampleSite/themes
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site# mv static exampleSite/themes
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site# mv theme.toml exampleSite/themes
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site# ls
exampleSite LICENSE.md README.md
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site# cd exampleSite
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite# ls
config.toml content data layouts static themes
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite# nano config.toml
(把baseurl的值改为"/")
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite# cd themes
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/themes# mkdir hugo-theme-geppaku
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/themes# ls
archetypes hugo-theme-geppaku images layouts static theme.toml
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/themes# mv archetypes hugo-theme-geppaku
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/themes# mv
images hugo-theme-geppaku
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/themes# mv
layouts hugo-theme-geppaku
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/themes# mv
static hugo-theme-geppaku
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/themes# mv
theme.toml hugo-theme-geppaku
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/themes# ls
hugo-theme-geppaku
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/themes# cd hugo-theme-geppaku
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/themes/hugo-theme-geppaku# ls
archetypes images layouts static theme.toml
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/themes/hugo-theme-geppaku# cd ../..
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite# ls
config.toml content data export layouts static themes
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite# cd export
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/export# ls
404.html css index.html page sitemap.xml
categories images index.xml post tags
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/export#
(可见/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/content/post# ls
2016
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/content/post# mkdir -p 2017/04/
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/content/post# cd 2017/04/
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/content/post/2017/04# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/content/post/2017/04# cat test-1.md
+++
date = "2017-04-23T00:45:05"
draft = false
title = "测试1"
slug = "test-1"
tags = [
"misc1",
"misc2",
"misc3",
]
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite/content/post/2017/04# cd /usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite
root@localhost:/usr/local/hugo-site/examples/hugo-theme-geppaku-site/exampleSite# hugo --source=. --destination=export
演示网站:http://htg.bright.biz.st/
项目地址:https://github.com/masa0221/hugo-theme-geppaku
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/camunda/blog.camunda.org
cd blog.camunda.org
root@localhost:/usr/local/hugo-site/examples/blog.camunda.org# nano config.toml
(把baseurl的值改为"/" ,把Paginate的值改为5)
root@localhost:/usr/local/hugo-site/examples/blog.camunda.org# hugo_0.17 --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/blog.camunda.org# cd export
root@localhost:/usr/local/hugo-site/examples/blog.camunda.org/export# ls
2013 css js
2014 favicon.ico page
2015 fonts post
404.html googledf37b0038c8a3fbd.html sitemap.xml
apple-touch-icon-precomposed.png index.html tags
categories index.xml
root@localhost:/usr/local/hugo-site/examples/blog.camunda.org/export#
(可见/usr/local/hugo-site/examples/blog.camunda.org/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/blog.camunda.org/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/blog.camunda.org/content/post#
root@localhost:/usr/local/hugo-site/examples/blog.camunda.org/content/post# ls
2013 2014 2015 2016
root@localhost:/usr/local/hugo-site/examples/blog.camunda.org/content/post# mkdir -p 2017/04
root@localhost:/usr/local/hugo-site/examples/blog.camunda.org/content/post# cd 2017/04
root@localhost:/usr/local/hugo-site/examples/blog.camunda.org/content/post/2017/04# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/blog.camunda.org/content/post/2017/04# cat test-1.md
+++
author = "brite fisherman"
date = "2017-04-20T14:24:03+05:30"
tags = ["misc1", "misc2", "misc3"]
title = "测试1"
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/blog.camunda.org/content/post/2017/04# cd ../../../..
root@localhost:/usr/local/hugo-site/examples/blog.camunda.org# hugo_0.17 --source=. --destination=export
演示网站:http://bco.bright.biz.st
项目地址:https://github.com/camunda/blog.camunda.org
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/kjhealy/kieranhealy.hugo kieranhealy.org
cd kieranhealy.org
root@localhost:/usr/local/hugo-site/examples/kieranhealy.org# nano config.yaml
(把baseurl的值改为"/" )
root@localhost:/usr/local/hugo-site/examples/kieranhealy.org# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/kieranhealy.org# cd export
root@localhost:/usr/local/hugo-site/examples/kieranhealy.org/export# ls
403 apple-touch-icon.png categories index.html publications teaching
404 archive css index.xml resources
404.html blog files javascripts sitemap.xml
root@localhost:/usr/local/hugo-site/examples/kieranhealy.org/export#
(可见/usr/local/hugo-site/examples/kieranhealy.org/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/kieranhealy.org/export# cd ../
root@localhost:/usr/local/hugo-site/examples/kieranhealy.org# cd content
root@localhost:/usr/local/hugo-site/examples/kieranhealy.org/content#
root@localhost:/usr/local/hugo-site/examples/kieranhealy.org/content# cd blog
root@localhost:/usr/local/hugo-site/examples/kieranhealy.org/content/blog# nano test-1.markdown
root@localhost:/usr/local/hugo-site/examples/kieranhealy.org/content/blog# cat test-1.markdown
---
author: brite fisherman
date: "2017-04-21T18:46:00"
#layout: post
slug: test-1
status: publish
title: 测试1
categories:
- misc1
- misc2
- misc3
---
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/kieranhealy.org/content/blog# cd ../..
root@localhost:/usr/local/hugo-site/examples/kieranhealy.org# hugo --source=. --destination=export
演示网站:http://kho.smt.biz.st, http://kho.smt.biz.st/blog/
项目地址:https://github.com/kjhealy/kieranhealy.hugo
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/ViGLug/viglug.org
cd viglug.org
root@localhost:/usr/local/hugo-site/examples/viglug.org# ls
archetypes content LICENSE readme.md
config.yml data layouts public static
root@localhost:/usr/local/hugo-site/examples/viglug.org# nano config.yml
(把baseurl的值改为"/" ,把其前面的#号去掉)
root@localhost:/usr/local/hugo-site/examples/viglug.org# hugo_0.17 --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/viglug.org# cd export
root@localhost:/usr/local/hugo-site/examples/viglug.org/export# ls
404.html chat css fonts index.html page
blog chi-siamo docs images index.xml sitemap.xml
categories contatti eventi incontri js tags
root@localhost:/usr/local/hugo-site/examples/viglug.org/export#
(可见/usr/local/hugo-site/examples/viglug.org/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/viglug.org/export# cd ../content/blog
root@localhost:/usr/local/hugo-site/examples/viglug.org/content/blog# nano 2017_04_27_test_1.md
root@localhost:/usr/local/hugo-site/examples/viglug.org/content/blog# cat 2017_04_27_test_1.md
---
date: 2017-04-27T13:33:00
tags: ["misc1", "misc2", "misc3"]
title: 测试1
slug: test-1
---
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/viglug.org/content/blog# cd ../..
root@localhost:/usr/local/hugo-site/examples/viglug.org# hugo_0.17 --source=. --destination=export
演示网站:http://vlo.bright.biz.st/
项目地址:https://github.com/ViGLug/viglug.org
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/doctorallen/davidrallen.com
cd davidrallen.com
root@localhost:/usr/local/hugo-site/examples/davidrallen.com# cd themes
root@localhost:/usr/local/hugo-site/examples/davidrallen.com/themes# git clone https://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/davidrallen.com/themes# ls
helix rockrock
root@localhost:/usr/local/hugo-site/examples/davidrallen.com/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/davidrallen.com# nano config.toml
(把baseurl的值改为"/",把theme的值改为"rockrock" )
root@localhost:/usr/local/hugo-site/examples/davidrallen.com# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/davidrallen.com# cd export
root@localhost:/usr/local/hugo-site/examples/davidrallen.com/export# ls
404.html categories img page tags
apple-touch-icon-precomposed.png css index.html series
blog favicon.ico index.xml sitemap.xml
root@localhost:/usr/local/hugo-site/examples/davidrallen.com/export#
(可见/usr/local/hugo-site/examples/davidrallen.com/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/davidrallen.com/export# cd ../content/blog
root@localhost:/usr/local/hugo-site/examples/davidrallen.com/content/blog# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/davidrallen.com/content/blog# cat test-1.md
+++
date = "2017-04-25T16:30:13-05:00"
title = "测试1"
tags = ["misc1", "misc2", "misc3"]
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/davidrallen.com/content/blog# cd ../..
root@localhost:/usr/local/hugo-site/examples/davidrallen.com# hugo --source=. --destination=export
演示网站:http://dac.bright.biz.st/
项目地址:https://github.com/doctorallen/davidrallen.com
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/peteraba/peteraba.com
cd peteraba.com
cd themes
root@localhost:/usr/local/hugo-site/examples/peteraba.com/themes# git clone https://github.com/chingli/rockrock
(这里不要克隆https://github.com/digitalcraftsman/hugo-icarus-theme,使用这个hugo-icarus-theme,在此会有问题)
root@localhost:/usr/local/hugo-site/examples/peteraba.com/themes# ls
rockrock
root@localhost:/usr/local/hugo-site/examples/peteraba.com/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/peteraba.com# nano config.toml
(把baseurl的值改为"/",把theme的值改为"rockrock")
root@localhost:/usr/local/hugo-site/examples/peteraba.com# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/peteraba.com# cd export
root@localhost:/usr/local/hugo-site/examples/peteraba.com/export#
(/usr/local/hugo-site/examples/peteraba.com/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/peteraba.com/export# cd ../content/blog
root@localhost:/usr/local/hugo-site/examples/peteraba.com/content/blog# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/peteraba.com/content/blog# cat test-1.md
+++
title = "测试1"
date = "2017-04-26T09:45:31"
tags = ["misc1", "misc2", "misc3"]
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/peteraba.com/content/blog# cd ../..
root@localhost:/usr/local/hugo-site/examples/peteraba.com# hugo --source=. --destination=export
演示网站:http://pa.bright.biz.st
项目地址:https://github.com/peteraba/peteraba.com
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/StefanoChiodino/go-web stefanochiodino-site
cd stefanochiodino-site
root@localhost:/usr/local/hugo-site/examples/stefanochiodino-site# nano config.toml
(把BaseUrl的值改为"/" ,把paginate的值改为3,把theme的值改为"hugo-theme-air")
root@localhost:/usr/local/hugo-site/examples/stefanochiodino-site# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/stefanochiodino-site# cd export
root@localhost:/usr/local/hugo-site/examples/stefanochiodino-site/export# ls
404.html index.html
about index.xml
admin js
categories loaderio-9bbb411f61ddddcf096cb8fc987d9877.txt
css loaderio-ca7e39cf77d0e533dc3658a0af3eac38.txt
example page
fonts post
forestryio robots.txt
icons sitemap.xml
images tags
root@localhost:/usr/local/hugo-site/examples/stefanochiodino-site/export#
(可见/usr/local/hugo-site/examples/stefanochiodino-site/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/stefanochiodino-site/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/stefanochiodino-site/content/post# mkdir -p 2017/04
root@localhost:/usr/local/hugo-site/examples/stefanochiodino-site/content/post# cd 2017/04
root@localhost:/usr/local/hugo-site/examples/stefanochiodino-site/content/post/2017/04# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/stefanochiodino-site/content/post/2017/04# cat test-1.md
+++
date = "2017-04-28T10:38:24+00:00"
draft = false
slug = "test-1"
tags = ["misc1", "misc2", "misc3"]
title = "测试1"
+++
这是测试1。
看看如何?
root@localhost:/usr/local/hugo-site/examples/stefanochiodino-site/content/post/2017/04# cd
/usr/local/hugo-site/examples/stefanochiodino-site
root@localhost:/usr/local/hugo-site/examples/stefanochiodino-site# hugo --source=. --destination=export
演示网站:http://scd.smt.biz.st
项目地址:https://github.com/StefanoChiodino/go-web
https://github.com/StefanoChiodino/go-web/issues/1
(源帖中不支持嵌入<!--more--> ,我嵌入了<!--more--> ,但是不起作用)
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/enten/hugo-boilerplate hugo-boilerplate-site
cd hugo-boilerplate-site
root@localhost:/usr/local/hugo-site/examples/hugo-boilerplate-site# nano config.toml
(把baseurl的值改为"http://yourdomain.com",把paginate的值改为3)
root@localhost:/usr/local/hugo-site/examples/hugo-boilerplate-site# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/hugo-boilerplate-site# cd export
root@localhost:/usr/local/hugo-site/examples/hugo-boilerplate-site/export# ls
2014 cv hyde-y post
2015 cv.html index.html sitemap.xml
404.html favicon.png index.xml tags
about fonts js topics
code hugo license touch-icon-144-precomposed.png
css hugo-boilerplate page
root@localhost:/usr/local/hugo-site/examples/hugo-boilerplate-site/export#
(所以 /usr/local/hugo-site/examples/hugo-boilerplate-site/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/hugo-boilerplate-site/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/hugo-boilerplate-site/content/post# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/hugo-boilerplate-site/content/post# cat test-1.md
---
author: "BRITE FISHERMAN"
date: 2017-04-28T20:40:00
title: 测试1
description: "点击标题,看全文"
tags:
- misc1
- misc2
- misc3
draft: false
slug: "test-1"
---
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/hugo-boilerplate-site/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/hugo-boilerplate-site# hugo_0.17 --source=. --destination=export
演示网站:http://hgbp.smt.biz.st/
项目地址:https://github.com/enten/hugo-boilerplate
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/mmrath/blog mmrath.github.io
cd mmrath.github.io
root@localhost:/usr/local/hugo-site/examples/mmrath.github.io# nano config.toml
(把baseurl的值改为http://urdomain.com,我的是http://mgi.smt.biz.st ,
把paginate的值改为3,
在paginate的下一行加上:
paginatePath = "/page" )
root@localhost:/usr/local/hugo-site/examples/mmrath.github.io# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/mmrath.github.io# cd export
root@localhost:/usr/local/hugo-site/examples/mmrath.github.io/export# ls
404.html categories favicon.ico index.xml post tags
assets css index.html page sitemap.xml
root@localhost:/usr/local/hugo-site/examples/mmrath.github.io/export#
(可见 /usr/local/hugo-site/examples/mmrath.github.io/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/mmrath.github.io/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/mmrath.github.io/content/post# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/mmrath.github.io/content/post# cat test-1.md
+++
title = "测试1"
description = ""
tags = ["misc1", "misc2", "misc3"]
date = "2017-04-29T17:50:00"
slug = "test-1"
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/mmrath.github.io/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/mmrath.github.io# hugo --source=. --destination=export
演示网站:http://mgi.smt.biz.st/
项目地址:https://github.com/mmrath/blog
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/mmrath/hugo-bootstrap hugo-bootstrap-site
cd hugo-bootstrap-site
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site# ls
archetypes exampleSite layouts README.md theme.toml
data images LICENSE.md static
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site# ls exampleSiteconfig.toml content layouts LICENSE README.md static
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site# mkdir exampleSite/themes
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site# mkdir exampleSite/themes/hugo-bootstrap
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site# mv archetypes exampleSite/themes/hugo-bootstrap
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site# mv data exampleSite/themes/hugo-bootstrap
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site# mv images exampleSite/themes/hugo-bootstrap
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site# mv layouts exampleSite/themes/hugo-bootstrap
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site# mv static exampleSite/themes/hugo-bootstrap
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site# mv theme.toml exampleSite/themes/hugo-bootstrap
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site#
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site# ls
exampleSite LICENSE.md README.md
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site# cd exampleSite
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site/exampleSite# ls
config.toml content layouts LICENSE README.md static themes
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site/exampleSite# nano config.toml
(把baseurl的值改为http://hgbs.smt.biz.st
在pagenate = 3那一行的下一行加上:
paginatePath= "/page" )
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site/exampleSite# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site/exampleSite# cd export
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site/exampleSite/export# ls
404.html categories index.xml post tags
assets index.html page sitemap.xml
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site/exampleSite/export#
(可见/usr/local/hugo-site/examples/hugo-bootstrap-site/exampleSite/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site/exampleSite/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site/exampleSite/content/post# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site/exampleSite/content/post# cat test-1.md
+++
title = "测试1"
description = ""
tags = ["misc1", "misc2", "misc3"]
date = "2017-04-29T19:27:00"
slug = "test-1"
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site/exampleSite/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-site/exampleSite# hugo --source=. --destination=export
演示网站:http://hgbs.smt.biz.st/
http://themes.gohugo.io/theme/bootstrap/
项目地址:https://github.com/mmrath/hugo-bootstrap
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone
root@localhost:/usr/local/hugo-site/examples# cd hugo-bootstrap-premium-site
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site# ls
archetypes exampleSite images LICENSE.md static
data i18n layouts README.md theme.toml
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site# mkdir -p exampleSite/themes/hugo-bootstrap-premium
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site# ls
archetypes exampleSite images LICENSE.md static
data i18n layouts README.md theme.toml
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site# mv archetypes exampleSite/themes/hugo-bootstrap-premium
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site# mv data exampleSite/themes/hugo-bootstrap-premium
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site# mv i18n exampleSite/themes/hugo-bootstrap-premium
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site# mv images exampleSite/themes/hugo-bootstrap-premium
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site# mv static exampleSite/themes/hugo-bootstrap-premium
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site# mv theme.toml exampleSite/themes/hugo-bootstrap-premium
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site# ls
exampleSite layouts LICENSE.md README.md
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site# mv layouts exampleSite
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site# ls
exampleSite LICENSE.md README.md
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site# cd exampleSite
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site/exampleSite# ls
config.toml content data layouts static themes
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site/exampleSite# nano config.toml
(把baseurl 的值改为http://yourdomain.com,我的是http://hgbsp.smt.biz.st
把paginate的值改为3
把paginatePath的值改为"/page")
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site/exampleSite# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site/exampleSite# cd export
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site/exampleSite/export# ls
2016 en index.xml post topics
2017 favicon.png js sitemap.xml touch-icon-144-precomposed.png
404.html fonts modal sv
css index.html page tags
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site/exampleSite/export#
(可见 /usr/local/hugo-site/examples/hugo-bootstrap-premium-site/exampleSite/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site/exampleSite/content/post# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site/exampleSite/content/post# cat test-1.md
+++
date = "2017-04-29T20:41:28"
draft = false
title = "测试1"
tags = ["misc1", "misc2", "misc3"]
slug = "test-1"
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site/exampleSite/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/hugo-bootstrap-premium-site/exampleSite# hugo --source=. --destination=export
演示网站:http://hgbsp.smt.biz.st/
项目地址:https://github.com/appernetic/hugo-bootstrap-premium
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/digitalcraftsman/hugo-steam-theme hugo-steam-theme-site
cd hugo-steam-theme-site
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site# ls
archetypes exampleSite layouts README.md theme.toml
CHANGELOG.md images LICENSE.md static
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site# cd exampleSite
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site/exampleSite# mkdir -p themes/hugo-steam-theme
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site/exampleSite# cd ..
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site# mv archetypes exampleSite/themes/hugo-steam-theme/
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site# mv images exampleSite/themes/hugo-steam-theme/
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site# mv static exampleSite/themes/hugo-steam-theme/
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site# mv theme.toml exampleSite/themes/hugo-steam-theme/
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site# mv layouts exampleSite/
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site# ls
CHANGELOG.md exampleSite LICENSE.md README.md
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site# cd exampleSite
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site/exampleSite# ls
config.toml content layouts static themes
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site/exampleSite# nano config.toml
(把baseurl的值改为"/" ,把paginate的值改为4
这里有点奇怪, 我把paginate的值改为4 ,但是生成的静态网站确实每3个帖子一页,而非每4个帖子一页)
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site/exampleSite# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site/exampleSite# cd export
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site/exampleSite/export# ls
404.html categories favicon.ico img index.xml page sitemap.xml
about css fonts index.html js post tags
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site/exampleSite/export#
(可见/usr/local/hugo-site/examples/hugo-steam-theme-site/exampleSite/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site/exampleSite/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site/exampleSite/content/post# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site/exampleSite/content/post# cat test-1.md
+++
title = "测试1"
tags = [
"misc1",
"misc2",
"misc3",
"misc4"
]
date = "2017-04-30T11:24:00"
description = "这是测试1"
slug = "test-1"
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site/exampleSite/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/hugo-steam-theme-site/exampleSite# hugo --source=. --destination=export
演示网站:http://hgst.smt.biz.st
项目地址:https://github.com/digitalcraftsman/hugo-steam-theme
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/budparr/gohugo-theme-ananke gohugo-theme-ananke-site
cd gohugo-theme-ananke-site
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site# cd exampleSite
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site/exampleSite# ls
config.toml content static
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site/exampleSite# mkdir -p themes/gohugo-theme-ananke
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site/exampleSite# ls
config.toml content static themes
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site/exampleSite# cd ..
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site# mv layouts exampleSite
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site# mv archetypes exampleSite/themes/gohugo-theme-ananke/
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site# mv images exampleSite/themes/gohugo-theme-ananke/
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site# mv static exampleSite/themes/gohugo-theme-ananke/
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site# mv theme.toml exampleSite/themes/gohugo-theme-ananke/
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site#
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site# ls
exampleSite LICENSE.md package.json README.md src
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site# cd exampleSite
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site/exampleSite# nano config.toml
(把baseURL的值改为"/" ,
把themesDir这一行注释掉或删除)
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site/exampleSite# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site/exampleSite# cd export
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site/exampleSite/export# ls
404.html categories dist index.html post sitemap.xml
about contact images index.xml robots.txt tags
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site/exampleSite/export#
(可见 /usr/local/hugo-site/examples/gohugo-theme-ananke-site/exampleSite/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site/exampleSite/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site/exampleSite/content/post# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site/exampleSite/content/post# cat test-1.md
---
date: "2017-05-01T14:07:05"
description: ""
tags: ["misc1", "misc2", "misc3"]
title: "测试1"
slug: "test-1"
---
这是测试1.
<!--more-->
看看如何?
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site/exampleSite/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/gohugo-theme-ananke-site/exampleSite# hugo --source=. --destination=export
演示网站:http://gta.smt.biz.st/,https://gohugo-ananke-theme-demo.netlify.com
项目地址:https://github.com/budparr/gohugo-theme-ananke
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/nickoneill/blog.nickoneill.name
cd blog.nickoneill.name
cd themes
root@localhost:/usr/local/hugo-site/examples/blog.nickoneill.name/themes# git clone https://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/blog.nickoneill.name/themes# ls
blog-nickoneill rockrock
root@localhost:/usr/local/hugo-site/examples/blog.nickoneill.name/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/blog.nickoneill.name#
root@localhost:/usr/local/hugo-site/examples/blog.nickoneill.name# ls
config.json develop.sh layouts sass update.sh
content export Readme.md themes
root@localhost:/usr/local/hugo-site/examples/blog.nickoneill.name# nano config.json
(把"baseurl"的值改为"/", 在"baseurl"这行的下一行加上: "theme": "rockrock", )
root@localhost:/usr/local/hugo-site/examples/blog.nickoneill.name# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/blog.nickoneill.name# cd export
root@localhost:/usr/local/hugo-site/examples/blog.nickoneill.name/export#
(/usr/local/hugo-site/examples/blog.nickoneill.name/export含有index.html文件,所以/usr/local/hugo-site/examples/blog.nickoneill.name/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/blog.nickoneill.name/export# cd ../content
root@localhost:/usr/local/hugo-site/examples/blog.nickoneill.name/content# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/blog.nickoneill.name/content# cat test-1.md
---
title: "测试1"
date: "2017-05-05T16:23:00"
slug: "test-1"
tags: ["misc1", "misc2", "misc3"]
---
这是测试1.
<!--more-->
看看如何?
root@localhost:/usr/local/hugo-site/examples/blog.nickoneill.name/content# cd ..
root@localhost:/usr/local/hugo-site/examples/blog.nickoneill.name# hugo --source=. --destination=export
演示网站:http://bnn.bright.biz.st
项目地址:https://github.com/nickoneill/blog.nickoneill.name
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/Dbzman/dbzman-online.eu
cd dbzman-online.eu
root@localhost:/usr/local/hugo-site/examples/dbzman-online.eu# ls
config.toml content layouts refresh.sh static themes
root@localhost:/usr/local/hugo-site/examples/dbzman-online.eu# cd themes
root@localhost:/usr/local/hugo-site/examples/dbzman-online.eu/themes# ls
dbzman-online
root@localhost:/usr/local/hugo-site/examples/dbzman-online.eu/themes# git clone https://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/dbzman-online.eu/themes# ls
dbzman-online rockrock
root@localhost:/usr/local/hugo-site/examples/dbzman-online.eu/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/dbzman-online.eu# nano config.toml
(把baseurl的值改为"/",把theme的值改为"rockrock" )
root@localhost:/usr/local/hugo-site/examples/dbzman-online.eu# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/dbzman-online.eu# cd export
root@localhost:/usr/local/hugo-site/examples/dbzman-online.eu/export#
(/usr/local/hugo-site/examples/dbzman-online.eu/export含有index.html,所以/usr/local/hugo-site/examples/dbzman-online.eu/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/dbzman-online.eu/export# cd ../content/blog
root@localhost:/usr/local/hugo-site/examples/dbzman-online.eu/content/blog# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/dbzman-online.eu/content/blog# cat test-1.md
+++
date = "2017-04-25T10:09:00+01:00"
title = "测试1"
+++
这是测试1.
<!--more-->
看看如何?
root@localhost:/usr/local/hugo-site/examples/dbzman-online.eu/content/blog# cd ../..
root@localhost:/usr/local/hugo-site/examples/dbzman-online.eu# hugo --source=. --destination=export
演示网站:http://doe.bright.biz.st
项目地址:https://github.com/Dbzman/dbzman-online.eu
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/spf13/spf13.com
cd spf13.com
root@localhost:/usr/local/hugo-site/examples/spf13.com# ls
archetypes config.toml content README.md layouts static
root@localhost:/usr/local/hugo-site/examples/spf13.com# mkdir bak
root@localhost:/usr/local/hugo-site/examples/spf13.com# mv archetypes bak
root@localhost:/usr/local/hugo-site/examples/spf13.com# mv layouts bak
root@localhost:/usr/local/hugo-site/examples/spf13.com# mv static bak
root@localhost:/usr/local/hugo-site/examples/spf13.com# ls
bak config.toml content README.md
root@localhost:/usr/local/hugo-site/examples/spf13.com# mkdir themes
root@localhost:/usr/local/hugo-site/examples/spf13.com/themes# git clone https://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/spf13.com/themes# ls
rockrock
root@localhost:/usr/local/hugo-site/examples/spf13.com/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/spf13.com# nano config.toml
(把baseurl的值改为"/"
在languageCode = "en-us"的下一行加上:
theme = "rockrock")
root@localhost:/usr/local/hugo-site/examples/spf13.com# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/spf13.com# cd export
root@localhost:/usr/local/hugo-site/examples/spf13.com/export# ls
404.html index.html presentation topics
apple-touch-icon-precomposed.png index.xml project
css page sitemap.xml
favicon.ico post tags
root@localhost:/usr/local/hugo-site/examples/spf13.com/export#
(可见/usr/local/hugo-site/examples/spf13.com/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/spf13.com/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/spf13.com/content/post# nano test-2.md
root@localhost:/usr/local/hugo-site/examples/spf13.com/content/post# cat test-2.md
---
Slug: test-2
Tags:
- misc1
- misc2
- misc3
Title: "测试2"
date: 2017-05-06T19:17:00
---
这是测试2.
<!--more-->
看看如何?
root@localhost:/usr/local/hugo-site/examples/spf13.com/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/spf13.com# hugo --source=. --destination=export
演示网站:http://spf13c.smt.biz.st
项目地址:https://github.com/spf13/spf13.com
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/antzucaro/az.com antzucaro.com
cd antzucaro.com
root@localhost:/usr/local/hugo-site/examples/antzucaro.com# ls
config.yaml content gallery.go layouts Makefile README.md static
root@localhost:/usr/local/hugo-site/examples/antzucaro.com# mkdir bak
root@localhost:/usr/local/hugo-site/examples/antzucaro.com# mv layouts bak
root@localhost:/usr/local/hugo-site/examples/antzucaro.com# mv static bak
root@localhost:/usr/local/hugo-site/examples/antzucaro.com# mkdir themes
root@localhost:/usr/local/hugo-site/examples/antzucaro.com# cd themes
root@localhost:/usr/local/hugo-site/examples/antzucaro.com/themes# git clone https://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/antzucaro.com/themes# ls
rockrock
root@localhost:/usr/local/hugo-site/examples/antzucaro.com/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/antzucaro.com# nano config.yaml
(把baseurl的值改为"/"
在baseurl这一行的下一行加上:
theme: "rockrock" )
root@localhost:/usr/local/hugo-site/examples/antzucaro.com# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/antzucaro.com# cd export
root@localhost:/usr/local/hugo-site/examples/antzucaro.com/export# ls
404.html categories index.html posts
about css index.xml sitemap.xml
apple-touch-icon-precomposed.png favicon.ico page tags
root@localhost:/usr/local/hugo-site/examples/antzucaro.com/export#
(可见/usr/local/hugo-site/examples/antzucaro.com/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/antzucaro.com/export# cd ../content
root@localhost:/usr/local/hugo-site/examples/antzucaro.com/content# ls
about.md posts
root@localhost:/usr/local/hugo-site/examples/antzucaro.com/content# cd posts
root@localhost:/usr/local/hugo-site/examples/antzucaro.com/content/posts# cd 2017
root@localhost:/usr/local/hugo-site/examples/antzucaro.com/content/posts/2017# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/antzucaro.com/content/posts/2017# cat test-1.md
---
title: "测试1"
date: "2017-05-06 22:10:00"
tags: ["misc1", "misc2", "misc3"]
slug: test-1
---
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/antzucaro.com/content/posts/2017# cd ../../..
root@localhost:/usr/local/hugo-site/examples/antzucaro.com# hugo --source=. --destination=export
演示网站:http://azcr.smt.biz.st/
项目地址:https://github.com/antzucaro/az.com
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/natefinch/npf npf.io
cd npf.io
root@localhost:/usr/local/hugo-site/examples/npf.io# ls
archetypes content LICENSE README.md themes
config.toml layouts production static
root@localhost:/usr/local/hugo-site/examples/npf.io# mkdir bak
root@localhost:/usr/local/hugo-site/examples/npf.io# mv archetypes bak
root@localhost:/usr/local/hugo-site/examples/npf.io# mv layouts bak
root@localhost:/usr/local/hugo-site/examples/npf.io# mv static bak
root@localhost:/usr/local/hugo-site/examples/npf.io# cd themes
root@localhost:/usr/local/hugo-site/examples/npf.io/themes# ls
herring-cove hyde
root@localhost:/usr/local/hugo-site/examples/npf.io/themes# git clone https://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/npf.io/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/npf.io# nano config.toml
( 把baseurl的值改为"/"
把theme的值改为"rockrock"
把blog的值由"/:year/:month/:filename/"改为"/:filename" )
root@localhost:/usr/local/hugo-site/examples/npf.io# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/npf.io# cd export
root@localhost:/usr/local/hugo-site/examples/npf.io/export# ls
2012 404.html deputy lumberjack.v2 series-desc
2013 about desc npipe.v2 sitemap.xml
2014 apple-touch-icon-precomposed.png favicon.ico page tags
2015 blog gorram pie
2016 code index.html post
2017 css index.xml series
root@localhost:/usr/local/hugo-site/examples/npf.io/export#
(可见/usr/local/hugo-site/examples/npf.io/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/npf.io/export# cd ../content/blog
root@localhost:/usr/local/hugo-site/examples/npf.io/content/blog# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/npf.io/content/blog# cat test-1.md
+++
date = "2017-05-07T11:16:00"
title = "测试1"
tags = ["misc1", "misc2", "misc3"]
slug = "test-1"
+++
这是测试1.
看看如何?
(注意:slug的值一定要加上英文双引号,否则会遇错:keys cannot contain new lines.而且在这个建站程序里,如果blog的值为"/:filename" ,则slug参数不起作用,比如“中国经济”这篇文章的url是http://npf.smt.biz.st/ce,而非http://npf.smt.biz.st/chinese-economy,所以此时,slug参数是多余的,完全可以不写。如果要使slug参数生效,则需删除config.toml文件中的如下一段内容:
[Permalinks] |
blog = "/:year/:month/:filename/" |
root@localhost:/usr/local/hugo-site/examples/npf.io# hugo --source=. --destination=export
演示网站:http://npf.smt.biz.st
项目地址:https://github.com/natefinch/npf
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/LK4D4/lk4d4.darth.io
cd lk4d4.darth.io
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io# ls
config.yaml content layouts Makefile static
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io# mkdir bak
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io# mv layouts bak
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io# mv static bak
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io#
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io# ls
bak config.yaml content Makefile
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io# mkdir themes
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io# cd themes
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io/themes# git clone https://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io# nano config.yaml
(删除layoutdir: "layouts"这一行,把baseurl的值改为"/" .
在baseurl那一行的下一行加上:
theme: "rockrock" )
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io# cd export
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io/export# ls
404.html css index.xml sitemap.xml
apple-touch-icon-precomposed.png favicon.ico page
categories index.html posts
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io/export#
(可见/usr/local/hugo-site/examples/lk4d4.darth.io/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io/export# cd ../content
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io/content#
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io/content# ls
posts
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io/content# cd posts
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io/content/posts# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io/content/posts# cat test-1.md
---
title: "测试1"
date: "2017-05-07T16:48:00"
tags:
- "misc1"
- "misc2"
- "misc3"
slug: "test-1"
---
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io/content/posts# cd ../..
root@localhost:/usr/local/hugo-site/examples/lk4d4.darth.io# hugo --source=. --destination=export
演示网站:http://ldi.smt.biz.st
项目地址:https://github.com/LK4D4/lk4d4.darth.io
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone --branch dev https://github.com/ninya-io/ninya-io.github.io
cd ninya-io.github.io
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io# ls
config.yaml deploy_mac.sh hugo layouts public static
content deploy_win.sh hugo.exe LICENSE README.md
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io# mkdir bak
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io# mv layouts bak
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io# mv static bak
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io# mkdir themes
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io# cd themes
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io/themes# git clone https://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io# nano config.yaml
(删除layoutdir: "layouts"这一行,把baseurl的值改为"/" .
在baseurl那一行的下一行加上:
theme: "rockrock" )
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io# cd export
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io/export# ls
404.html css index.xml sitemap.xml
apple-touch-icon-precomposed.png favicon.ico page
categories index.html posts
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io/export#
(可见 /usr/local/hugo-site/examples/ninya-io.github.io/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io/export# cd ../content
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io/content# ls
posts
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io/content# cd posts
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io/content/posts# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io/content/posts# cat test-1.md
---
title: "测试1"
date: "2017-05-07T18:07:00"
tags:
- "misc1"
- "misc2"
- "misc3"
slug: "test-1"
---
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io/content/posts# cd ../..
root@localhost:/usr/local/hugo-site/examples/ninya-io.github.io# hugo --source=. --destination=export
演示网站:http://nyi.smt.biz.st
项目地址: https://github.com/ninya-io/ninya-io.github.io/tree/dev
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/danmux/danmux-hugo danmux.com
cd danmux.com
root@localhost:/usr/local/hugo-site/examples/danmux.com# ls
config.yaml data Jenkinsfile LICENSE oldblog static
content holding layouts Makefile README.md
root@localhost:/usr/local/hugo-site/examples/danmux.com#
root@localhost:/usr/local/hugo-site/examples/danmux.com# mkdir bak
root@localhost:/usr/local/hugo-site/examples/danmux.com# mv layouts bak
root@localhost:/usr/local/hugo-site/examples/danmux.com# mv static bak
root@localhost:/usr/local/hugo-site/examples/danmux.com# mkdir themes
root@localhost:/usr/local/hugo-site/examples/danmux.com# cd themes
root@localhost:/usr/local/hugo-site/examples/danmux.com/themes# git clone https://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/danmux.com/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/danmux.com# nano config.yaml
(删除此行layoutdir: "layouts"和此行publishdir: "../public"
把baseurl的值改为"/"
在baseurl的下一行加上:
theme: "rockrock" )
root@localhost:/usr/local/hugo-site/examples/danmux.com# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/danmux.com# cd export
root@localhost:/usr/local/hugo-site/examples/danmux.com/export# ls
404.html css index.xml sitemap.xml
apple-touch-icon-precomposed.png favicon.ico page
categories index.html posts
root@localhost:/usr/local/hugo-site/examples/danmux.com/export#
(可见/usr/local/hugo-site/examples/danmux.com/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/danmux.com/export# cd ../content/posts
root@localhost:/usr/local/hugo-site/examples/danmux.com/content/posts# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/danmux.com/content/posts# cat test-1.md
---
title: "测试1"
date: "2017-05-08T11:28:00"
tags:
- "misc1"
- "misc2"
- "misc3"
slug: "test-1"
---
这是测试1.
<!--more-->
看看如何?
root@localhost:/usr/local/hugo-site/examples/danmux.com/content/posts# cd ../..
root@localhost:/usr/local/hugo-site/examples/danmux.com# hugo --source=. --destination=export
演示网站:http://dmc.smt.biz.st
项目地址:https://github.com/danmux/danmux-hugo
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/peteraba/devmonk.com
cd devmonk.com
root@localhost:/usr/local/hugo-site/examples/devmonk.com# ls
config.yaml content layouts README.md static
root@localhost:/usr/local/hugo-site/examples/devmonk.com# mkdir bak
root@localhost:/usr/local/hugo-site/examples/devmonk.com# mv layouts bak
root@localhost:/usr/local/hugo-site/examples/devmonk.com# mv static bak
root@localhost:/usr/local/hugo-site/examples/devmonk.com# mkdir themes
root@localhost:/usr/local/hugo-site/examples/devmonk.com# cd themes
root@localhost:/usr/local/hugo-site/examples/devmonk.com/themes# git clone https://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/devmonk.com/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/devmonk.com# nano config.yaml
(把baseurl的值改为"/"
在baseurl的下一行加上:
theme: "rockrock" )
root@localhost:/usr/local/hugo-site/examples/devmonk.com# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/devmonk.com# cd export
root@localhost:/usr/local/hugo-site/examples/devmonk.com/export# ls
404.html css index.html page
about-me en index.xml sections
apple-touch-icon-precomposed.png favicon.ico kategoriak sitemap.xml
categories hu langs topics
root@localhost:/usr/local/hugo-site/examples/devmonk.com/export#
(可见/usr/local/hugo-site/examples/devmonk.com/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/devmonk.com/export# cd ../content
root@localhost:/usr/local/hugo-site/examples/devmonk.com/content#
root@localhost:/usr/local/hugo-site/examples/devmonk.com/content# ls
about-me.md en hu
root@localhost:/usr/local/hugo-site/examples/devmonk.com/content# cd en
root@localhost:/usr/local/hugo-site/examples/devmonk.com/content/en# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/devmonk.com/content/en# cat test-1.md
+++
title = "测试1"
date = "2017-05-08T12:30:00"
tags = ["misc1", "misc2", "misc3"]
slug = "test-1"
+++
这是测试1.
看看如何?
root@localhost:/usr/local/hugo-site/examples/devmonk.com/content/en# cd ../..
root@localhost:/usr/local/hugo-site/examples/devmonk.com# hugo --source=. --destination=export
演示网站:http://dm.smt.biz.st
项目地址:https://github.com/peteraba/devmonk.com
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/tomhelmer/website-source www.thehome.dk
cd www.thehome.dk
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk# ls
archetypes config.toml content Makefile README.md static themes
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk#
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk# mkdir bak
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk# mv archetypes bak
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk# mv static bak
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk# cd themes
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk/themes# ls
ago
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk/themes# git clone https://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk# nano config.toml
(把baseurl的值改为"/"
在baseurl的下一行加上:
theme = "rockrock" )
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk# cd export
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk/export# ls
404.html article favicon.ico page
about categories index.html sitemap.xml
apple-touch-icon-precomposed.png css index.xml tags
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk/export#
(可见/usr/local/hugo-site/examples/www.thehome.dk/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk/export# cd ../content
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk/content# ls
about.md article categories.md
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk/content# cd article
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk/content/article# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk/content/article# cat test-1.md
+++
title = "测试1"
date = "2017-05-08T17:36:00"
tags = ["misc1", "misc2", "misc3"]
slug = "test-1"
+++
这是测试1.
<!--more-->
看看如何?
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk/content/article# cd ../..
root@localhost:/usr/local/hugo-site/examples/www.thehome.dk# hugo --source=. --destination=export
演示网站:http://wtd.smt.biz.st/
项目地址:https://github.com/tomhelmer/website-source
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/consequently/consequently-hugo consequently.org
cd consequently.org
root@localhost:/usr/local/hugo-site/examples/consequently.org# ls
config.toml content layouts notes public static
root@localhost:/usr/local/hugo-site/examples/consequently.org# mkdir bak
root@localhost:/usr/local/hugo-site/examples/consequently.org# mv layouts bak
root@localhost:/usr/local/hugo-site/examples/consequently.org# mv static bak
root@localhost:/usr/local/hugo-site/examples/consequently.org# mkdir themes
root@localhost:/usr/local/hugo-site/examples/consequently.org# cd themes
root@localhost:/usr/local/hugo-site/examples/consequently.org/themes# git clone http://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/consequently.org/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/consequently.org# nano config.toml
(把baseurl的值改为"/"
在baseurl的下一行加上:
theme = "rockrock" )
root@localhost:/usr/local/hugo-site/examples/consequently.org# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/consequently.org# cd export
root@localhost:/usr/local/hugo-site/examples/consequently.org/export# ls
404.html css news tags
apple-touch-icon-precomposed.png favicon.ico page writing
categories index.html presentation
class index.xml sitemap.xml
root@localhost:/usr/local/hugo-site/examples/consequently.org/export#
(可见/usr/local/hugo-site/examples/consequently.org/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/consequently.org/export# cd ../content
root@localhost:/usr/local/hugo-site/examples/consequently.org/content# ls
class news presentation writing
root@localhost:/usr/local/hugo-site/examples/consequently.org/content# cd writing
root@localhost:/usr/local/hugo-site/examples/consequently.org/content/writing# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/consequently.org/content/writing# cat test-1.md
+++
title = "测试1"
date = "2017-05-10T09:03:00"
tags = ["misc1", "misc2", "misc3"]
slug = "test-1"
+++
这是测试1.
<!--more-->
看看如何?
root@localhost:/usr/local/hugo-site/examples/consequently.org/content/writing# cd ../..
root@localhost:/usr/local/hugo-site/examples/consequently.org# hugo --source=. --destination=export
演示网站:http://csq.smt.biz.st
项目地址:https://github.com/consequently/consequently-hugo
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/mariobox/mariosanchez.org-hugo mariosanchez.org
cd mariosanchez.org
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org# mkdir bak
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org# mv archetypes bak
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org# mv layouts bak
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org# mv static bak
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org# mkdir themes
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org# cd themes
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org/themes# git clone https://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org# ls
bak config.toml content README.md themes
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org# mv config.toml
config.toml.old
(这里,我们不用它原来的config.toml,否则后面, 运行hugo --source=. --destination=export命令后,所生成的export目录会不正常,所生成的export目录不包含index.html)
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org# nano config.toml
(新建的config.toml的内容如下:
baseurl = "/"
languageCode = "zh-CN"
hasCJKLanguage=true
title = "Example"
theme = "rockrock"
[Params]
subTitle = "it is the blog of brite fisherman"
copyright = "2017 by brite" )
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org# cd export
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org/export# ls
404.html colophon good-stuff photos
about contact index.html post
apple-touch-icon-precomposed.png css index.xml reading
book favicon.ico now sitemap.xml
categories gallery page tags
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org/export#
(可见 /usr/local/hugo-site/examples/mariosanchez.org/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org/content/post# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org/content/post# cat test-1.md
+++
tags = ["misc1", "misc2", "misc3"]
date = "2017-05-10T14:37:39"
slug = "test-1"
title = "测试1"
+++
这是测试1.
<!--more-->
看看如何?
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/mariosanchez.org# hugo --source=. --destination=export
演示网站:http://mso.smt.biz.st
项目地址:https://github.com/mariobox/mariosanchez.org-hugo
https://github.com/chingli/rockrock/
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/RickCogley/RCC-Hugo2015 rick.cogley.info
cd rick.cogley.info
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info# mkdir bak
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info# mv archetypes bak
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info# mv layouts bak
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info# mv static bak
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info# mkdir themes
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info# cd themes
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info/themes# git clone https://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info# ls
bak config.toml content README.md themes
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info# mv config.toml
config.toml.old
(这里,我们不用它原来的config.toml,否则后面, 运行hugo --source=. --destination=export命令后,所生成的export目录会不正常,所生成的export目录不包含index.html)
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info# nano config.toml
(新建的config.toml的内容如下:
baseurl = "/"
languageCode = "zh-CN"
hasCJKLanguage=true
title = "Example"
theme = "rockrock"
[Params]
subTitle = "it is the blog of brite fisherman"
copyright = "2017 by brite" )
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info# cd export
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info/export# ls
404.html categories index2 page
about colophon index.html post
apple-touch-icon-precomposed.png css index.xml sitemap.xml
articles favicon.ico license tags
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info/export#
(可见/usr/local/hugo-site/examples/rick.cogley.info/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info/export# cd ../content/post
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info/content/post# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info/content/post# cat test-1.md
+++
tags = ["misc1", "misc2", "misc3"]
date = "2017-05-11T14:29:39"
slug = "test-1"
title = "测试1"
+++
这是测试1.
<!--more-->
看看如何?
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info/content/post# cd ../..
root@localhost:/usr/local/hugo-site/examples/rick.cogley.info# hugo --source=. --destination=export
演示网站:http://rci.smt.biz.st
项目地址:https://github.com/RickCogley/RCC-Hugo2015
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/lucumt/ghblog lucumt.info
cd lucumt.info
root@localhost:/usr/local/hugo-site/examples/lucumt.info# ls
archetypes config.toml content layouts LICENSE public README.md static
root@localhost:/usr/local/hugo-site/examples/lucumt.info# mkdir bak
root@localhost:/usr/local/hugo-site/examples/lucumt.info# mv archetypes bak
root@localhost:/usr/local/hugo-site/examples/lucumt.info# mv layouts bak
root@localhost:/usr/local/hugo-site/examples/lucumt.info# mv static bak
root@localhost:/usr/local/hugo-site/examples/lucumt.info# mkdir themes
root@localhost:/usr/local/hugo-site/examples/lucumt.info# cd themes
root@localhost:/usr/local/hugo-site/examples/lucumt.info/themes# git clone https://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/lucumt.info/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/lucumt.info# mv config.toml config.toml.old
root@localhost:/usr/local/hugo-site/examples/lucumt.info# nano config.toml
(新建的config.toml的内容如下:
baseurl = "/"
languageCode = "zh-CN"
hasCJKLanguage=true
title = "Example"
theme = "rockrock"
[Params]
subTitle = "it is the blog of brite fisherman"
copyright = "2017 by brite" )
root@localhost:/usr/local/hugo-site/examples/lucumt.info# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/lucumt.info# cd export
root@localhost:/usr/local/hugo-site/examples/lucumt.info/export# ls
404.html css index.xml sitemap.xml
apple-touch-icon-precomposed.png favicon.ico page tags
categories index.html posts
root@localhost:/usr/local/hugo-site/examples/lucumt.info/export#
(可见/usr/local/hugo-site/examples/lucumt.info/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/lucumt.info/export# cd ../content
root@localhost:/usr/local/hugo-site/examples/lucumt.info/content# ls
about.md posts
root@localhost:/usr/local/hugo-site/examples/lucumt.info/content# cd posts
root@localhost:/usr/local/hugo-site/examples/lucumt.info/content/posts# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/lucumt.info/content/posts# cat test-1.md
+++
tags = ["misc1", "misc2", "misc3"]
date = "2017-05-10T18:09:39"
slug = "test-1"
title = "测试1"
+++
这是测试1.
<!--more-->
看看如何?
root@localhost:/usr/local/hugo-site/examples/lucumt.info/content/posts# cd ../..
root@localhost:/usr/local/hugo-site/examples/lucumt.info# hugo --source=. --destination=export
演示网站:http://lci.smt.biz.st
项目地址:https://github.com/lucumt/ghblog
再克隆另一个人的网站源码:
cd /usr/local/hugo-site/examples/
git clone https://github.com/richardsumilang-blog/richardsumilang-blog.github.io
cd richardsumilang-blog.github.io
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io# mkdir bak
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io# mv layouts bak
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io# mv static bak
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io# mkdir themes
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io# cd themes
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io/themes# git clone http://github.com/chingli/rockrock
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io/themes# cd ..
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io# nano config.toml
(把baseurl的值改为"/"
把theme的值改为"rockrock" )
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io# hugo --source=. --destination=export
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io# cd export
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io/export# ls
404.html css index.xml sitemap.xml
apple-touch-icon-precomposed.png electronics networking tags
apps etc page unix-like
blog favicon.ico programming
categories index.html server
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io/export#
(可见/usr/local/hugo-site/examples/richardsumilang-blog.github.io/export就是静态网站的根目录)
新建源帖:
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io/export# cd ../content/etc/
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io/content/etc# nano test-1.md
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io/content/etc# cat test-1.md
+++
tags = ["misc1", "misc2", "misc3"]
date = "2017-05-11T16:52:39"
slug = "test-1"
title = "测试1"
+++
这是测试1.
<!--more-->
看看如何?
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io/content/etc# cd ../..
root@localhost:/usr/local/hugo-site/examples/richardsumilang-blog.github.io# hugo --source=. --destination=export
演示网站:http://rsb.smt.biz.st
项目地址:https://github.com/richardsumilang-blog/richardsumilang-blog.github.io
再克隆另一个人的网站源码:
cd /usr/local/
git clone https://github.com/ryanchapman/blog.rchapman.org
cd blog.rchapman.org
root@localhost:/usr/local/blog.rchapman.org# nano config.toml
(把baseurl的值改为你的域名地址,我的为"http://bro.bright.biz.st/" ,记得末尾加上英文斜杠。)
root@localhost:/usr/local/blog.rchapman.org# cd content/posts
root@localhost:/usr/local/blog.rchapman.org/content/posts# nano test-3.md
root@localhost:/usr/local/blog.rchapman.org/content/posts# cat test-3.md
---
title: "测试3"
date: "2017-07-25 09:25:00"
categories:
- "misc1"
- "misc2"
- "misc3"
---
这是测试3.
看看如何?
root@localhost:/usr/local/blog.rchapman.org/content/posts# cd ../..
root@localhost:/usr/local/blog.rchapman.org# hugo --source=. --destination=public
演示网站:http://bro.bright.biz.st
项目地址:https://github.com/ryanchapman/blog.rchapman.org
https://gohugo.io/showcase/
https://gohugo.io/community/press
https://gohugo.io/hosting-and-deployment/hosting-on-github/
https://gohugo.io/hosting-and-deployment/hosting-on-bitbucket/
https://gohugo.io/hosting-and-deployment/hosting-on-gitlab/
https://gohugo.io/hosting-and-deployment/hosting-on-netlify/
https://gohugo.io/hosting-and-deployment/hosting-on-firebase/
https://github.com/spf13/HugoBasicExample (未研究透彻)
https://github.com/spf13/hugoThemes
https://github.com/spf13/hugoThemesSite
https://github.com/spf13/hugoThemeSiteScript
http://ktmud.github.io/huggle/en/intro/
------------
How To Add Pagination To Your Hugo Blog
I recently moved my blog from Jekyll to Hugo, using the Hugo Zen theme. While I love the simplicity of the theme (and its use of Skeleton instead of Bootstrap), it doesn’t come with pagination already baked in. So, I decided to add some of my own. For reference, the Hugo docs do indeed cover pagination, but it wasn’t totally intuitive to me. So, here’s how I tackled it:In the
layouts/partials folder
, I created a new file called pagination.html
{{ $pag := $.Paginator }} {{ if gt $pag.TotalPages 1 }}
{{ end }} Next, in my
index.html
, I called the Paginate object:{{ partial "header.html" . }}
-
{{ $pag := .Paginate (where .Data.Pages ".Params.hidefromhome" "!=" "true") }}
{{ range $pag.Pages }}
{{ .Title }}
from https://www.jasongowans.net/post/2016-12-30-how-to-paginate-hugo-blog/
------------
通过webhook将Hugo自动部署至GitHub Pages和GitCafe Pages
本文的主要内容如标题所示,通过webhook将Hugo自动部署至GitHub Pages和GitCafe Pages。如果你正好有这个需求,看这篇文章正好,可以节省你不少时间。如果不是,了解一下也无妨。
首先,必须解释一下,为什么需要自动部署,以及为什么需要需要同时部署到GitHub Pages和GitCafe Pages。
为什么要自动部署
使用Hugo生成的静态页面是在public文件夹里,部署的时候需要把public文件夹里的内容push到GitHub的gh-pages分支里。每次写完文章,除了push markdown格式的文章,还需要单独push生成的public文件夹里的东西,步骤稍显麻烦。
之前参照了官方的做法,使用subtree来push public,步骤简化不少。然而,这还是不够简单。因为每次修改文章之后,必须依赖一个脚本才能正确提交和部署。假如你在手机里浏览时,发现一个错别字,顺手就在GitHub的Web界面就把错别字改了,然而这样并不会重新生成静态页面和部署。有些不方便。
Hugo生成静态页面和部署的过程应该让机器自动来完成。写作应该是一个相对单纯的事情,使用Hugo的人应该更专注于写作。
为什么需要同时部署到GitHub Pages和GitCafe Pages
大公司很喜欢的一个词:容灾。GitHub出现不可访问的事情在国内也是常有的,而GitCafe作为国内的代码托管厂商,是否是一个稳定的存在也不好说。所以,将网站同时部署到这两个上面。通过DnsPod里CNAME设置线路“国内”和“国外”,不仅起到了任何一个挂掉,另一个可以继续工作的目的,还起到了CDN就近访问的作用。
使用GitCafe还有另外一个原因。GitHub Pages拒绝了一切百度的爬虫,所以,百度无法索引到GitHub Pages的网页。对于国内的搜索市场来说,百度的份额还是比较大的,虽然我认为看我的博客的人都不应该使用百度,但现实总是残酷的。如果希望网站被百度收录,就必须放到GitHub以外的地方。GitCafe就是一种比较好的选择。
如果,你只是希望使用官方的Hugo自动化部署到GitHub Pages,下面的内容你可以不用看了。你可以直接使用Wercker的服务来自动部署。
文档见: http://gohugo.io/tutorials/automated-deployments/
由于Wercker还不支持GitCafe的部署,以及我需要使用特定的修改版本的Hugo来生成静态网页,并且希望这些步骤比较可控,所以,还是自己来折腾整个过程吧。
webhook
webhook是GitHub上提供的Git的一种Hook机制,当代码发生变化时,比如代码被Push到GitHub的Repo时,GitHub会自动请求一个你指定的网页,并且把变更相关的参数都传递过来。入口在Repo的Settings - webhooks & services.
说明文档:https://developer.github.com/webhooks/
借助webhook的机制,我们就可实现当有新的文章Push之后,自动通知远程的一台机器执行一个脚本,脚本的内容就是生成静态页面和Push部署到最终的服务器。
webhook的Server接收webhook通知,然后执行一个脚本。这样的需求太普遍了,以至于完全不需要自己来实现。在GitHub里搜webhook可以搜出来很多。我主要挑选了Go语言的版本。主要有两个:
第一个是七牛写的,代码很简单,用法也很简单。开始打算用七牛的版本。最后调试的时候发现json解析失败,完全不可用啊!有点坑爹。于是换成了第二个,这个Repo有200多个Star。还是靠谱很多,最后部署,调试,非常顺利。
用法也很简单,首先安装webhook:
$ go get github.com/adnanh/webhook
写一个配置文件hooks.json,里面指定需要执行的脚本:
[
{
"id": "redeploy-webhook",
"execute-command": "/var/scripts/redeploy.sh",
"command-working-directory": "/var/webhook"
}
]
指定端口启动:
$ /path/to/webhook -hooks hooks.json -port=9876 -verbose
然后它将接受webhook地址:(把它填到GitHub里的webhook里)
http://yourserver:9876/hooks/redeploy-webhook
自动部署
大致的流程如上图。上图的DigitalOcean是一台VPS服务器,我用了很长时间了,速度和稳定性都不错。需要的同学使用这个链接购买,可以获得10美元的优惠:https://www.digitalocean.com/?refcode=e131e2bba197
整个流程中,复杂度主要是在DigitalOcean的VPS上部署服务和脚本。
部署的脚本可以在我的GitHub上看到:https://github.com/coderzh/coderzh-hugo-blog
需要的同学可以参考下,代码见https://github.com/coderzh/coderzh-hugo-blog/blob/master/deploy.py
deploy.py放到你的主工程,也就是你写markdown的Repo下。比如:/var/coderzh-hugo-blog/下
adnanh-webhook的配置文件:
[
{
"id": "hugo-deploy",
"execute-command": "/var/webhook/hugo-deploy.sh"
}
]
hugo-deploy.sh里执行deploy.py:
#!/bin/bash
python /var/coderzh-hugo-blog/deploy.py --auto
剩下的是怎么在DigitalOcean的VPS上把这套东西部署起来。我使用nginx + supervisor搭建webhook的Server。
supervisor的配置如下:
[program:webhook]
command=/root/gocode/bin/webhook -hooks /var/webhook/hooks.json -verbose -port=9876
user=root
directory=/var/webhook
autorestart=true
redirect_stderr=true
environment=HOME="/root",USER="root"
关于VPS上SSH Key的设置,见:https://help.github.com/articles/generating-ssh-keys/ 为了自动部署方便,可以不设置密码。
当然,还有个大前提,在VPS上安装最新版本的golang。推荐使用gvm来安装。(记得安装1.5之前必须先把1.4先装上)
golang 安装:
bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
source ~/.bashrc
gvm version
gvm install go1.4
gvm install go1.5.1
gvm use go1.5.1 --default
go version
最后,Good Luck!
相关帖子:
https://briteming.blogspot.com/2017/02/git-webhook.html
https://briteming.blogspot.com/2020/04/go-git-webhook.html
--------------------------------------
用来发布Obsidian知识库。
ob.doingnothing.online项目介绍
作用
将markdown文档作为知识库,类似于obsidian中的知识库联结结构,来作为一个在线知识库。阅读和查询都比较不错,但是不适合做博客,因为知识库内容量巨大。 此项目由oldwinter的项目二次修改得到。 对基本的一些文件以及配置进行了初始化,方便了部署以及一些功能的基本配置。 可以参考我的-ob-进行配置.
from https://github.com/songshua295/ObPublish (based on hugo)
----------------------------------------------------------
Hugo + GitHub Action,搭建你的博客自动发布系统
我的方案主要分为以下几个核心部分:
- 个人博客源仓库,对博客配置及所有文章
.md
源文件进行版本管理,配合 GitHub Action 进行自动化部署,自动生成静态站点推送到 GitHub Pages 博客发布仓库。 - GitHub Pages 博客发布仓库,以
username.github.io
形式命名的仓库,使用 GitHub Pages 实现网站部署,可以通过配置域名 CNAME 解析使用自定义域名。 - Hugo 主题仓库,fork 喜欢的主题,并对自己的个人定制化改造配置进行版本管理,通过
git submodule
的方式链接到个人博客源仓库。
下文会对搭建、本地测试、自动化部署维护等过程进行详细讲解,希望对大家所有帮助。
使用 Hugo 搭建博客
Hugo 是用 Go 实现的博客工具,采用 Markdown 进行文章编辑,自动生成静态站点文件,支持丰富的主题配置,也可以通过 js 嵌入像是评论系统等插件,高度定制化。除了 Hugo 外, 还有 Gatsby、Jekyll、Hexo、Ghost 等选择,实现和使用都差不多,可以根据自己的偏好进行选择。
安装 Hugo
我使用的是 macOS,所以使用官方推荐的 homebrew 方式进行 hugo 程序的安装,其他系统也类似。
brew install hugo
完成后,使用以下命令进行验证:
hugo version
创建 Hugo 网站
通过上述命令安装 hugo 程序后,就可以通过 hugo new site
命令进行网站创建、配置与本地调试了。
hugo new site blog-test
配置主题
当通过上文命令创建我们的站点后,需要进行主题配置,Hugo 社区有了很丰富的主题,可以通过官网 Themes 菜单选择自己喜欢的风格,查看预览效果,选择后可以进入主题项目仓库,一般都会有很详细的安装及配置说明。下面我就以我目前在使用的 hugo-theme-den 这个主题为例,演示一下配置流程。
关联主题仓库
我们可以将主题仓库直接 git clone
下来进行使用,但这种方式有一些弊端,当之后自己对主题进行修改后,可能会与原主题产生一些冲突,不方便版本管理与后续更新。我采用的是将原主题仓库 fork
到自己的账户,并使用 git submodule
方式进行仓库链接,这样后续可以对主题的修改进行单独维护。
cd blog-test/
git init
git submodule add https://github.com/pseudoyu/hugo-theme-den themes/hugo-theme-den
更新主题
如果是 clone 了其他人的博客项目进行修改,则需要用以下命令进行初始化:
git submodule update --init --recursive
如果需要同步主题仓库的最新修改,需要运行以下命令:
git submodule update --remote
初始化主题配置及发布
每个主题一般都会提供一些实例配置与初始页面,开始使用主题时可以将其 exampleSite/
目录下的文件复制到站点目录下,在此基础上进行调整配置。
cp -rf themes/hugo-theme-den/exampleSite/* ./
初始化主题基础配置后,我们可以在 config.toml
文件中进行站点细节配置,具体配置项参考各主题说明文档。
完成后,可以通过 hugo new
命令发布新文章。
hugo new posts/blog-test.md
本地调试站点
Hugo 会生成静态网页,我们在本地编辑调试时可以通过 hugo server
命令进行本地实时调试预览,无须每次都重新生成。
hugo server
运行服务后,我们可以通过浏览器 http://localhost:1313
地址访问我们的本地预览网页。
使用 GitHub Pages的 前期准备
域名购买
作为一个对外发布的网站,我们需要购买一个域名并配置解析,指向我们网站所在的服务器,才能让外界以比较方便的方式访问。域名购买平台很多,我用过的有 Cloudflare、NameSilo、GoDaddy 等,我最后常用的还是 Cloudflare,因为其同时还提供了 CDN、网站数据分析、定制规则等强大功能。
首先我们需要注册一个 Cloudflare 账户,登录后选择左侧边栏的“注册域”,并搜索自己想注册的域名。
选择了心仪的域名后,点击并选择购买时限并填写个人信息。
选择付款方式,建议可以选择自动续订,以免忘记续费。
类型选择 Personal 即可,并点击‘完成购买’。
等待 Cloudflare处理后,即可查看信息。
GitHub Pages 仓库
GitHub Pages 项目需要符合 username.github.io
的特殊命名格式,仓库建立完成后,可以在设置中配置自己注册的自定义域名来指向 GitHub Pages 生成的网址。此外,需要将博客站点配置文件 config.toml
中的 baseURL
改为自己的自定义域名,格式为 "https://www.xyz.com/"
,才能正常访问 GitHub Pages 生成的网站服务。
域名解析
按照上文步骤注册好后,需要在域名托管商进行 DNS 解析,在这里我们需要选择 CNAME,指向我们的 GitHub Pages 网址。
因为 CNAME解析没办法设置 root 域名,即只能设置 www.xyz.com
或其他子域名,而不是 xyz.com
,因此,我们可以通过
Cloudflare 上自定义规则,设置域名重定向,具体配置如下,仅需将我的域名替换成自己的域名即可。即使你是通过 NameSilo
注册的域名,也可以通过 Cloudflare 来添加站点以实现功能,或者其他托管平台也有类似的功能,按照说明,配置即可。
GitHub Pages 发布博客
完成上述准备工作后,我们现在已经可以通过自定义域名来访问我们的 GitHub Pages 页面了,目前因为项目仓库是空的,访问后会报 404
页面。
我们希望 Hugo 生成的静态网站能通过 GitHub Pages 服务进行托管,而无需自己维护服务,更稳定、安全,因此我们需要上传 Hugo 生成的静态网页文件至 GitHub Page 项目仓库。
手动发布
当我们编辑博客内容并通过 hugo server
本地调试后,就可以通过 hugo
命令生成静态网页文件了。
hugo
cd public/
Hugo 默认会将生成的静态网页文件存放在 public/
目录下,我们可以通过将 public/
目录初始化为 git 仓库并关联我们的 abc/abc.github.io
远程仓库来推送我们的网页静态文件。
git init
git remote add origin git@github.com:abc/abc.github.io
git add .
git commit -m "add test"
核对文件修改后,即可通过 git push origin master
推送到 GitHub Pages 仓库,稍等几分钟即可通过我们的自定义域名来访问我们的博客站点了,和我们 hugo server
本地调试完全一致。
自动发布
通过上述命令我们可以手动发布我们的静态文件,但还是有以下弊端:
- 发布步骤还是比较繁琐,本地调试后还需要切换到
public/
目录进行上传 - 无法对博客
.md
源文件进行备份与版本管理
因为我们的博客基于 GitHub 与 GitHub Pages,可以通过官方提供的 GitHub Action 进行 CI 自动发布,下面我会进行详细讲解。GitHub Action 是一个持续集成和持续交付(CI/CD) 平台,可用于自动执行构建、测试和部署管道,目前已经有很多开发好的工作流,可以通过简单的配置即可直接使用。
配置文件在仓库目录.github/workflows
下,以 .yml
为后缀。我的 GitHub Action 配置为https://github.com/pseudoyu/yu-blog/blob/master/.github/workflows/deploy.yml
自动发布的示例配置文件的内容如下:
name: deploy
on:
push:
workflow_dispatch:
schedule:
# Runs everyday at 8:00 AM
- cron: "0 0 * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "latest"
- name: Build Web
run: hugo
- name: Deploy Web
uses: peaceiris/actions-gh-pages@v3
with:
PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
EXTERNAL_REPOSITORY: pseudoyu/pseudoyu.github.io
PUBLISH_BRANCH: master
PUBLISH_DIR: ./public
commit_message: ${{ github.event.head_commit.message }}
on
表示 GitHub Action 触发条件,我设置了 push
、workflow_dispatch
和 schedule
三个条件:
push
,当这个项目仓库发生推送动作后,执行 GitHub Actionworkflow_dispatch
,可以在 GitHub 项目仓库的 Action 工具栏进行手动调用schedule
,定时执行 GitHub Action,如我的设置为北京时间每天早上执行,主要是使用一些自动化统计 CI 来自动更新我博客的关于页面,如本周编码时间,影音记录等,如果你不需要定时功能,可以删除这个条件
jobs
表示 GitHub Action 中的任务,我们设置了一个 build
任务,runs-on
表示 GitHub Action 运行环境,我们选择了 ubuntu-latest
。我们的 build
任务包含了 Checkout
、Setup Hugo
、Build Web
和 Deploy Web
四个主要步骤,其中 run
是执行的命令,uses
是 GitHub Action 中的一个插件,我们使用了 peaceiris/actions-hugo@v2
和 peaceiris/actions-gh-pages@v3
这两个插件。其中 Checkout
步骤中 with
中配置 submodules
值为 true
可以同步博客源仓库的子模块,即我们的主题模块。
首先需要将上述 deploy.yml
中的 EXTERNAL_REPOSITORY
改为自己的 GitHub Pages 仓库,如我的设置为 pseudoyu/pseudoyu.github.io
。
因为我们需要从博客仓库推送到外部 GitHub Pages 仓库,需要特定权限,要在 GitHub 账户下 Setting - Developer setting - Personal access tokens
下创建一个 Token:
权限需要开启
repo
与 workflow
:配置后复制生成的 Token(注:只会出现一次),然后在我们博客源仓库的 Settings - Secrets - Actions
中添加 PERSONAL_TOKEN
环境变量为刚才的 Token,这样 GitHub Action 就可以获取到 Token 了。
完成上述配置后,推送代码至仓库,即可触发 GitHub Action,自动生成博客页面并推送至 GitHub Pages 仓库:
而 GitHub Pages 仓库更新后,又会自动触发官方页面部署 CI,实现我们的网站发布:
经过上述配置,我们已经实现了 Hugo 博客本地搭建及版本管理、GitHub Pages 部署网站发布,Hugp 主题管理及更新等功能,实现了完整的系统。现在每当我们本地通过熟悉的 Markdown 语法完成博客内容编辑后,只需要推送代码,等待几分钟,即可通过我们的自定义域名访问更新后的网站。
参考资料
--------------------------
GROW YOUR AUDIENCE WITH HUGOBLOX! 🚀 HugoBlox is an easy, fast no-code website builder for researchers, entrepreneurs, data scientists, and developers. Build stunning sites in minutes. 适合研究人员、企业家、数据科学家和开发者的简单快速无代码网站构建器。用拖放功能、可定制模板和内置SEO工具快速创建精美网站!
hugoblox.com/templates/Hugo Blox Builder: easy, all-in-one website builder
🔥 1. Create any kind of website for free with Hugo-powered blocks - from landing pages, knowledge bases, and courses to professional resumés, conferences, and tech blogs
🎨 2. Personalize a beautiful starter template with 50+ light/dark color themes, language packs, and blocks
🛋 3. Optionally, write from your sofa or on the go with the integrated open source Content Management System (CMS) based on Decap CMS
Check out the latest demos of what you'll get in less than 60 seconds, or get inspired by other creators.
- 👉 Get Started
- 📚 View the documentation
- 🙋♀️ Have a question?
- Chat with us now on Discord or explore the Troubleshooting Guide and Q&A Forum
- Also, check out Hugo Forum for Hugo Qs and Netlify Forum for Netlify Qs
- 🐦 Share your Hugo Blox Builder site with the community on Twitter: @GetResearchDev @GeorgeCushen #MadeWithHugoBlox
- 🗳 Take the survey and help us improve #OpenSource
- ⬆️ Updating? View the Update Guide and Release Notes
- 🚀 Contribute improvements or suggest improvements
Hugo Blox Builder is a no-code framework for creating any kind of website using widgets. Each site is 100% customizable to make it your own!
Choose from one of the starter templates to easily get started.Write rich, future-proof content using standardized Markdown along with bundled extensions for math and diagrams. Edit in the open source CMS or via an editor such as the online GitHub Editor, Jupyter Notebook, or RStudio! Learn more.
Key features:
- Page builder - Create anything with blocks and elements
- Edit any type of content - Blog posts, publications, talks, slides, projects, and more!
- Create content in Markdown, Jupyter, or RStudio
- Plugin System - Fully customizable color and font themes
- Display Code and Math - Code highlighting and LaTeX math supported
- Integrations - Google Analytics, Disqus commenting, Maps, Contact Forms, and more!
- Beautiful Site - Simple and refreshing one page design
- Industry-Leading SEO - Help get your website found on search engines and social media
- Media Galleries - Display your images and videos with captions in a customizable gallery
- Mobile Friendly - Look amazing on every screen with a mobile friendly version of your site
- Multi-language - 35+ language packs including English, 中文, and Português
- Multi-user - Each author gets their own profile page
- Privacy Pack - Assists with GDPR
- Stand Out - Bring your site to life with animation, parallax backgrounds, and scroll effects
- One-Click Deployment - No servers. No databases. Only files.
Hugo Blox Builder comes with automatic day (light) and night (dark) mode built-in. Alternatively, click the moon icon in the top right of one of the Demos to set your preferred mode!
Choose a stunning theme for your site and customize it to your liking.Browse more templates and themes...
- Academic File Converter: Automatically import academic publications from BibTeX to Markdown files
- Awesome Hugo: Scripts to help migrate content to new versions of Hugo
from https://github.com/HugoBlox/hugo-blox-builder