十年没碰过代码,近两天研究了下GO语言,弄了个Hugo+Github搭建了一个静态博客,配置GIt,下载Hugo,搭建GIthub。最后发现简书后台 打包下载文章 .MD文件。本以为简书 Markdown 文档可以直接使用,但是Hugo的Markdown代码好像和简书不兼容。最后需要用到Markdown编辑器转…这尼玛就KD了!
果断放弃,为了Github这点免费无限量的仓库耽误的时间,一点都不划算。
不过既然干了,也花了点时间研究,就记录下来把。
啥时候兴趣来了,再继续…
Hugo本地生产静态页面,上传后速度快,稳定
关键是Github的免费空间和二级域名,全开源,任何源都可以进行尝试。
Step 1: Install Hugo
brew install hugo
---安装Hugo
hugo version
--查看安装情况和版本
Hugo Static Site Generator v0.69.1-17661DEB windows/amd64 BuildDate: 2020-04-22T07:58:06Z
--现在版本号v0.69
Step 2: Create a New Site
hugo new site 名称
--现在新建一个站点'名称'可以自己定
Step 3: Add a Theme
git clone https://github.com/coderzh/hugo-rapid-theme.git
git clone https://github.com/ShawnTeoh/matjek.git
git clone https://github.com/chaomifan/anglesladder.git
---安装主题,我很喜欢这3个祖逖,记录一下
Step 4: Add Some Content
hugo new pots/20200423.md
---新建一篇文件名为20200423.md的博文在Post文件夹下
Step 5: Start the Hugo server
hugo server -t hugo-rapid-theme --buildDrafts
hugo server -t maupassant --buildDrafts
hugo server -t anglesladder --buildDrafts
--启动Hugo服务,对应安装主题
hugo --theme=hugo-rapid-theme --baseUrl=“https://andyxxx.github.io” --buildDrafts
----生成 Public 文件夹
Step 6:Site Configuration
git init
git add .
git commit -m "0423”
配置Git,0423是随便备注的今天的日期
Step 7: Build static pages
git remote add origin https://github.com/Andyxxx/Andyxxx.github.io.git
--关联Github仓库
git remote rm origin
--如果报错可以清一次
git remote add origin https://github.com/Andyxxx/Andyxxx.github.io.git
--再次关联
git push -u origin master
---最后推上Github就可以了
---这一步会要求你输入Github注册的帐号及密码
hugo相比Hexo、Jekyll、Pelican要更简单,简单几条命令就可以建好。
日更只需4条命令就可以线上同步静态Html页面,速度肯定是最快的。
到一段落了,有空再折腾。

网友评论