Hugo是由Go語言實現的靜態網站生成器。相比hexo更簡單、易用、高效、易擴展、快速部署。git
進入github下載地址,選擇對應系統的二進制文件,好比個人電腦windows 64位就下載 hugo_0.55.5_Windows-64bit.zip github
解壓出來就是一個EXE文件,加入到環境變量便可windows
先安裝go,git,設置GOPATH 命令行執行 go get -u -v github.com/gohugoio/hugo,成功後會生成二進制文件瀏覽器
打開命令行,我使用的是cmder,固然自帶的cmd也行。hexo
mkdir blog cd blog hugo new site .
目錄結構爲 網站
使用md語法編輯文件ui
hugo new hello.md vi hello.md
cd themes git clone https://github.com/spf13/hyde.git
hugo server --theme=hyde --buildDrafts Building sites … | EN +------------------+----+ Pages | 11 Paginator pages | 0 Non-page files | 0 Static files | 6 Processed images | 0 Aliases | 0 Sitemaps | 1 Cleaned | 0 Total in 335 ms Watching for changes in d:\blog\{content,data,layouts,static,themes} Watching for config changes in d:\blog\config.toml Environment: "development" Serving pages from memory Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender Web Server is available at http://localhost:1313/ (bind address 127.0.0.1) Press Ctrl+C to stop
瀏覽器裏打開: http://localhost:1313 命令行
在github創建一個repo,好比username.github.io,注意username爲本身的用戶名,不能爲其餘的。 hugo --theme=hyde --baseUrl="http://xxx.github.io/"
這樣靜態頁面都會生成到 public 目錄,將pubilc目錄裏全部文件 push 到剛建立的Repo的 master 分支就能夠了。code
cd public git init git remote add origin https://github.com/xxx/xxx.github.io.git git add . git commit -m "hugo" git push -u origin master
打開瀏覽器訪問:http://xxx.github.io/server
好了,你的博客搭建成功了,開始你的博客之旅吧。 公衆號:蘇生不惑