当前位置:网站首页>博客搭建七:hugo
博客搭建七:hugo
2022-07-28 06:55:00 【亲自巡山的大王】
打算把写博客长期坚持下去,考虑到后面博文数量会慢慢增多,hexo框架会越来越捉襟见肘,于是把博客从hexo迁移至hugo。
安装hugo
首先从GitHub上下载hugo,地址:https://github.com/gohugoio/hugo
根据自己的电脑下载相应的版本,下载下来后解压到一个文件目录(出于习惯最好选择全英文路径下吧)然后将hugo文件所在的路径地址添加到系统变量path中就可以使用了。
不用安装!
不用安装!
不用安装!
在cmd命令中验证:
hugo version
出现下面语句证明hugo可以正常使用了
Hugo Static Site Generator v0.70.0/extended windows/amd64 BuildDate: unknown
注册GitHub账号
新建一个空仓库,仓库名称:usename.github.io,为后面的GitHub pages做准备,如果随便起名,后面就不能把博客部署到GitHub上了。
安装Git
我在博客搭建一中写了参见:http://t.csdn.cn/sSAIU基本上下载下来一路下一步就可以了,然后将把git和你的仓库进行链接,这样才能把本地文件推送进你的博客仓库里。git的作用是把你的本地博客文件推送到GitHub pages上,这样别人就能通过站点地址访问到你的博客了,快乐源于分享。
建立博客站点
在某一个文件夹目录下,运行cmd命令:
hugo new site xxx # xxx为你为你的本地博客的名字,以后所有的文件都在这个目录下
然后该目录下就会生成一堆文件,这些都不用管,我们只关心content文件夹、theme文件夹和config.toml文件,这里面包含了我们的博文.md文件存放处,主题设置和hugo基础页面设置,例如改网站名作者名等等。
选择一个博客主题
因为hugo没有带默认主题,也就没有博客页面,所以要先找一个博客主题,在hugo官网上或者GitHub上找都可以,然后按照不同的主题上面的操作指导进行即可,建议先选一个简单的,先把博客搭建起来,然后再慢慢选主题,我选用的主题是loveit。
新建一篇博文
hugo new posts/xxx.md
这样就会在content文件夹下生成posts文件夹,有些主题的某个标签会指向posts文件夹,最好创建以下,即不要直接hugo new xxx.md,不然可能会找不到你的博客内容。然后再该文件夹下生成xxx.md文件,该文件就是你后面编辑文章的文件,用你熟悉的markdown软件写内容就可以了。
部署博客
在博客根目录下用cmd命令或直接git bash here 输入:
hugo
会在博客根目录生成public文件夹,里面的文件就是我们要推送到仓库的文件。在该目录下用cmd命令或直接git bash here 。
第一次推送要先与仓库地址建立联系:
git init
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/usename/usename.github.io.git # **注:这里要改成你的仓库地址,不然推送不成功**
git push -u origin main
以后添加文章:
在public文件夹下操作
git add .
git commit -m "add blog post"
git push
至此你的博客基本上就搭建好了,后面就是写博客和选主题了,至于主题如何选,就仁者见仁智者见智了。
边栏推荐
- Unity中队列(Queue)的简单使用
- 2021-07-02
- QT uses semaphores to control threads (qsemaphore)
- Three different numbers with 0 in leetcode/ array
- Usage of qmap
- The fourth phase (2021-2022) research on the implementation of cloud native technology in traditional industries - central state-owned enterprises was officially released
- Brief introduction to ThreadLocal class
- Kubernetes技术与架构(七)
- CarSim simulation quick start (XI) - Driver Model (1)
- ASP. Net core foundation V
猜你喜欢

Can‘t connect to server on ‘IP‘ (60)

Common solutions for distributed ID - take one

Melt cloud x chat, create a "stress free social" habitat with sound

OSPF comprehensive experiment (7.12)

2022 Niuke multi school first problem solving Report

CarSim simulation quick start (10) - Modeling of braking system

C#,入门教程——程序运行时的调试技巧与逻辑错误探针技术与源代码

Understand CDN

See how Google uses pre training weights in target detection tasks | CVPR 2022

Prescan quick start to master the transportation elements in lesson 14, prescan
随机推荐
Enum class
Change the dataDir path after mysql8.0.16 installation
Chairman tree review
PMP practice once a day | don't get lost in the exam -7.13
ASP. Net core foundation V
[chart component kit] Shanghai daoning provides developers with steema download, trial and tutorial
[book club issue 13] Chapter 1 multimedia processing tools ffmpeg tools
CarSim simulation quick start (XII) - Driver Model (2)
MCU IO port controls 12V voltage on and off, MOS and triode circuit
金属质感登录框样式
Five screens, VR, projection, "Wei Xiaoli" rolled up on the intelligent cockpit
PostgreSQL is the world's most advanced open source relational database
One key switch circuit
Deluxe H5 Tetris game source code
How to write a JMeter script common to the test team
uniapp---- 获取当前位置的经纬度等信息的详细步骤(包含小程序)
C#,入门教程——程序运行时的调试技巧与逻辑错误探针技术与源代码
Leetcode/ sum of two numbers in a sorted array
Brief introduction to ThreadLocal class
2018年1月西邻雪山自驾游攻略