Hugo快速搭建Blog

简介:

1 安装

 ---------------------------

推荐二进制安装(简单、快速)

到 Hugo Releases 下载对应的操作系统版本的Hugo二进制文件(hugo或者hugo.exe)

Hugo Releases:h t tp s : / /g i th ub . com / go h ug oi o/ hu g o /r e l ea s e s

本文以Windows为例,所以下载:hugo_0.24.1_Windows-64bit.zip

下载之后解压得到“hugo.exe”文件。

将hugo.exe所在的目录添加到系统环境变量PATH下面,打开cmd,输入“hugo version”。

 

2 创建站点&文章

---------------------------------------

想要创建站点,一个命令搞定,切换到你想要创建站点的目录,输入:

D:\git>hugo new site blog
Congratulations! Your new Hugo site is created in D:\git\blog.

Just a few more steps and you're ready to go:

1. Download a theme into the same-named folder.
   Choose a theme from https://themes.gohugo.io/, or
   create your own with the "hugo new theme <THEMENAME>" command.
2. Perhaps you want to add some content. You can add single files
   with "hugo new <SECTIONNAME>\<FILENAME>.<FORMAT>".
3. Start the built-in live server via "hugo server".

Visit https://gohugo.io/ for quickstart guide and full documentation.

一个blog站点就创建好了。新建的站点目录结果如下:

blog/
    archetypes/ 
    doc/
    content/ 
    data/ 
    layouts/ 
    static/ 
    config.toml

 

当前的站没有任何内容,也没做任何配置。

接下来切换到blog站点目录,创建一篇文章:

D:\git>cd blog
D:\git\blog>hugo new about.md

该文件位于 blog/content/about.md目录下。打开编辑:

+++
date = "2017-07-03T15:37:11+08:00"
tags = ["blog"]
title = "my first blog"

+++

### 这里使用markdown来编写文章

markdown 教程:ht tp : / / w o w ub u nt u .c o m / ma rk d  ow n/

 

3 安装主题

 ---------------------------

站点一定要有主题,安装主题应该是最难的一步了,因为不同的主题设置方式也会有所不同。

Hugo themes:h t t ps : / / the m e s .g o h ug o . io/

你可以到上面的网站中挑选你喜欢的主题。然后,根据指引找到github项目地址进行下载。

 

3.1 下载主题:

我使用的主题是:ht t ps : // gi t hu b . co m / w d/ hu g o- f  a b  r i c

把主题通过git克隆或直接下载到本地。放到 …/blog/themes/目录下。

 

3.2 使用主题:

生成主题资源文件(hugo-fabric为主题名)

D:\git\blog>hugo -t hugo-fabric
Started building sites ...
Built site for language en:
0 of 3 drafts rendered
0 future content
0 expired content
8 regular pages created
12 other pages created
0 non-page files copied
2 paginator pages created
1 tags created
1 categories created
total in 35 ms

将\blog\themes\hugo-fabric\exampleSite\config.toml 替换 \blog\config.toml

注:config.toml文件是核心,对网站的配置多数需要修改该文件,而每个主题的配置又不完全一样。

 

4 启动服务器

 ------------------------------

D:\git\blog>hugo server
WARNING: Site config's rssURI is deprecated and will be removed in a future release. Set baseName in outputFormats.RSS.
Started building sites ...
Built site for language en:
0 draft content
0 future content
0 expired content
1 regular pages created
8 other pages created
0 non-page files copied
1 paginator pages created
1 tags created
0 categories created
total in 9 ms
Watching for changes in D:\git\blog\{data,content,layouts,static,themes}
Serving pages from memory
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

 

打开浏览器访问:http://localhost:1313/



本文转自lzwxx 51CTO博客,原文链接:http://blog.51cto.com/13064681/1944356
相关文章
|
9月前
|
Go 开发工具 git
blog-engine-04-博客引擎 hugo intro 入门介绍+安装笔记
该文是关于博客引擎的系列文章,对比了jekyll、hugo、Hexo、Pelican、Gatsby、VuePress、Nuxt.js和Middleman。文章包括jekyll的安装和SEO,hugo和Hexo的入门,Pelican和Gatsby的介绍,VuePress和Nuxt.js的特性,以及Middleman的概述。Hugo是一个基于Go语言的快速、简单的静态网站生成器,特点包括速度快、易用、灵活和跨平台。文章还提供了Hugo在Windows上的安装步骤及创建、预览和发布网站的指南。
|
开发工具 git Ruby
|
JavaScript Linux Go
How to use hexo to create blog?
How to use hexo to create blog?
126 0
|
弹性计算 资源调度 JavaScript
VuePress安装--Drizzt's Blog
轻量级文档服务器,可以用做博客和技术文档,可以部署在Github
689 0
VuePress安装--Drizzt's Blog
|
资源调度 JavaScript 前端开发
|
JavaScript 网络安全 开发工具
基于Hexo+Node.js+github+coding搭建个人博客——基础篇
附上个人教程:http://www.ookamiantd.top/2017/build-blog-hexo-base/ 搭建此博客的动机以及好处在此就不多谈了,之前已经表达过,详情请看Start My Blog Trip — Power By Hexo 记录一下搭建的基本过程以及遇到的一些问题,仅供参考 = =废话不多说,进入主题 Hexo博客搭建的基础大致流程为: 安装Node.
2427 0
|
开发工具 git
Hugo入门
1创建站点:hugo new site "+文件夹名"2下载博客主题:打开https://themes.gohugo.io/,复制粘贴命令即可3新建文章:hugo new "+文件名.md"4启动hugo:hugo serve --主题名 --buildDrafts5解决fatal: Not a g...
1147 0
|
机器人 Java Docker
Docker + anoyi-blog 打造专属个人简书
写在前面   anoyi-blog,一款有趣的开源个人博客建站工具,简单梳理下分享给大家。该工具基于 Docker, 可快速搭建和一键生成个人博客,用于实时解析简书文章、作者信息,专为个性化而生! Docker命令 docker run -d --na...
1521 0
|
开发工具 git JavaScript
基于github+hexo搭建个人博客(window)
0x01 环境搭建 1、Node.js环境 下载Node.js安装文件:https://nodejs.org/en/download/ 根据系统选择相应安装包下载,安装过程一路Next,默认设置即可。
1224 0
|
Web App开发 开发工具 git