当前位置:网站首页>Hugo 博客搭建教程
Hugo 博客搭建教程
2022-06-12 18:28:00 【村雨遥】
前言
有了利用 Hexo、docsify、vuepress 等框架来搭建博客的经历之后,我们来今天又来看看 Hugo。Hugo 是一款基于 Go 语言而实现的静态网站生成器,具有简单易用、高效易扩展、快速部署的特点。
这里先给出 Hugo 的中英文官方文档,方便大家遇到问题时查阅:
接下来就来看看,如何利用 Hugo 来搭建一个博客。
搭建过程
安装 Hugo
既然要使用 Hugo,那么首先需要对它进行安装。如果要通过二进制安装包的方式进行安装,那么首先需要到这里去进行选择适合自己平台的安装包,然后下载它。
这里不仅有适合 Windows 平台的安装包,还包括了 Linux 平台和 macOS 平台的安装包。不仅如此,针对不同用户,还细心地提供了 32 位和 64 位来供选择。更甚至针对不同架构的芯片也提供了相应的安装包,可以说是十分细心了。
不过这里我演示主要是基于 macOS 平台,所以我就不通过安装包的形式来进行安装了,这里通过 homebrew 一行命令就能够轻松搞定。
brew install hugo如果你的 macOS 上还没有安装 homebrew,那么先抓紧去安装下吧。
这里温馨提示下,国内用户依照 homebrew 官网的方式来进行安装基本上都是会失败的,所以这里给大家推荐另一种安装方式,通过以下脚本进行安装即可。
/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"检查是否成功
虽然通过上述的命令安装后,控制台是提示我们安装成功了,但我们心里没谱呀,就想看看到低安装成功了没。那这个时候就可以通过查看 Hugo 版本号的方式,来却 Hugo 是否安装成功。
hugo version如果安装成功了,那么执行命令后就会像我们上面那样,提示你所安装的 Hugo 的版本。
初始化网站
既然安装好了,接下来就是初始化我们的网站目录了。通过以下命令,我们就能够完成 Hugo 项目的初始化了!
hugo new site [项目名称]hugo new site JavaPark项目初始化后,得到的目录如下。
这里主要需要需要注意 config.toml ,这是项目的配置文件,主要用于配置 Hugo,该文件中的配置会对整个工程有效。theme 目录下主要用于放置主题,里边一般还会有一个 theme.toml,用于配置主题。
默认情况下,config.toml 里边只会有以下三个配置。
设置主题
为了给我们的网站设置样式,我们需要去选择一个喜欢的主题。Hugo 虽然不像 Hexo 提供了较多的主题,但是也还是有很多不错的,大家可以去皮肤列表找。
这里我选择了一个皮肤 m10c,进入我们初始化的项目,然后利用如下命令将主题下载到 theme 文件夹下。
git clone https://github.com/vaga/hugo-theme-m10c.git themes/m10c接着到项目配置文件 config.toml 中,设置主题。
theme = "m10c"预览
设置好主题之后,就可以进行预览了!使用如下命令启动 Hugo 服务器,然后进入 http://localhost:1313 就可以进行预览了!
hugo server -D总结
以上就是如何利用 Hugo 搭建一个博客了,主要从 Hugo 安装、初始化项目、主题设置、预览等几个方面介绍了 Hugo 的使用,剩下的就是写作了。这是件很难的事,希望大家能一直坚持下去。其实 Hugo 里边还有好多玩法,这里就不做一一介绍了,大家可以去官网探索更多玩法。
边栏推荐
- C brief introduction
- Review of MySQL (3): query operation
- Comparison of disk mapping tools for network disk and object cloud storage management
- Machine learning series (5): Naive Bayes
- 01-复杂度
- Review of MySQL (4): sorting operation
- Solution to the problem that the anaconda navigator card logo cannot be opened and the card will flash back - replace the alicloud image source
- Review of MySQL (I): go deep into MySQL
- 迄今微软不同时期发布的SQL Server各版本之间的大致区别,供参考查阅
- 机器学习系列(3):Logistic回归
猜你喜欢

Overall flow chart of kernel interrupt

DRM driven MMAP detailed explanation: (I) preliminary knowledge
![Interior design style type, rendering 100 invitation code [1a12]](/img/90/8bbfbe33c5b412498744c0ea0ed559.jpg)
Interior design style type, rendering 100 invitation code [1a12]

Introduction to reinforcement learning and analysis of classic items 1.3
![Free measurement of rectangular card [manual drawing ROI] Based on Halcon](/img/c5/d9109ed4024aff521e1788c63bff4e.png)
Free measurement of rectangular card [manual drawing ROI] Based on Halcon

Double non grind one, three side byte, cool. Next time

Shenzhen has been shut down for 7 days since March 14. Home office experience | community essay solicitation

MYSQL:Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated column

GD32F4xx控制DGUS触控按键

有源差分晶振原理图以及LV-PECL、LVDS、HCSL区别
随机推荐
309. the best time to buy and sell stocks includes the freezing period
Regression analysis based on elasticnetcv
Esp-idf adds its own components
Explanation of core interrupt of Godson processor
MIPS general purpose register + instruction
TypeScript常用类型(一)
Gd32f4xx controls dgus variable display
Gossip about the source code of redis 89
C language learning -- data storage in memory
从源码解析 MobX 响应式刷新机制
Schematic diagram of active differential crystal oscillator and differences among lv-pecl, LVDS and HCSL
Partial scratch and corrosion detection of bolts and screws based on Halcon
Problems that the sap Spartacus e-commerce cloud UI shipping method does not display in the unit test environment
ftrace
Getting started with the go language is simple: read / write lock
01-复杂度
基于halcon—缺陷检测常用方法与示例总结
js两数之和
279. perfect square
MySQL advanced learning notes