这几天研究了用hugo搭建个人博客。
简单的整理了一下。
1.安装hugo(windows 请查看官网介绍 https://gohugo.io/getting-started/installing/)
 
$ brew install hugo
之后检查版本
 
$ hugo version
Hugo Static Site Generator v0.37.1 darwin/amd64 BuildDate:
2.创建hugo 项目
 
$ hugo new site my-blog
Congratulations! Your new Hugo site is created in /Users/limingxie/Projects/my-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.
3.添加主题

$ cd my-blog
$ git init
$ git submodule add https://github.com/keichi/vienna.git themes/vienna
4.添加内容(content目录下执行。例:/Users/limingxie/Projects/my-blog/content)
 
$ hugo new xxx/my-first-blog.md
 
编辑:my-first-blog.md
5.运行调试
$ hugo server -D

                   | EN
+------------------+----+
Pages | 16
Paginator pages | 0
Non-page files | 0
Static files | 14
Processed images | 0
Aliases | 1
Sitemaps | 1
Cleaned | 0 Total in 26 ms
Watching for changes in /Users/limingxie/Projects/pangpang/pangpang-blog/{content,data,layouts,static,themes}
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at //localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
访问[http://localhost:1313/]调试~
6.Theme的设定
 
打开config.toml
baseURL = "https://limingxie.github.io/" //这baseURL是部署后的访问地址。
languageCode = "en-us"
title = "My New Hugo Site"
theme = "vienna" // 你使用的theme 名称

查看[vienna Theme]说明的话还可以做很多设置。

7.部署到GitHub
1)首先在GitHub上创建一个Repository,命名为:limingxie.github.io (这要和你的baseURL一致。)
2)在/Users/limingxie/Projects/my-blog目录下执行以下命令
$ hugo --theme=vienna --buildDrafts --baseUrl="https://limingxie.github.io/"

                   | EN
+------------------+----+
Pages | 16
Paginator pages | 0
Non-page files | 0
Static files | 14
Processed images | 0
Aliases | 1
Sitemaps | 1
Cleaned | 0 Total in 28 ms
--buildDrafts 不加会生成无内容的网站
--baseUrl要和config.toml的地址一致。
 
顺利的话会创建public文件(里面的内容就是你要上传的静态网站的文件。)
 
$ cd public
$ git init
$ git remote add origin https://github.com/limingxie/limingxie.github.io.git
$ git add -A
$ git commit -m "first commit"
$ git push -u origin master
### 浏览器里访问:https://limingxie.github.io/ 就可以访问你的博客了
----------------------------------------------
欢迎大家的意见和交流
email: li_mingxie@163.com
博客:https://limingxie.github.io/

用hugo搭建个人博客的更多相关文章

  1. 如何用hugo搭建个人博客

    如何用hugo搭建个人博客 1. 安装 Hugo 点击跳转 Hugo Releases win10 步骤: 下载解压 , 然后添加环境变量 测试: #命令行测试 hugo version 2. 创建站 ...

  2. 利用 Hexo 或者 hugo 搭建个人博客

    我们无法选择生活的样子,但我们可以记下来. 博客的开始 其实,一切都是为了更好的装逼.好吧,我着相了. 最开始想做一个自己博客,主要是因为看到了很多人都有,觉得自己没有太 Low 了.于是申请了 CS ...

  3. hugo搭建个人博客

    本地先安装git 1. 下载hugo,并配置好环境变量 我这里win7 64位,选择该版本下载 将解压后的hugo.exe,配置到环境变量中,如下图所示表明配置成功 hugo version 2. 生 ...

  4. 使用Hugo搭建个人博客站点

    Hugo是个什么东东这里直接忽略,想了解的请查阅其他资料,我们直接上手操作. 安装Hugo 到 Hugo Releases 下载对应的操作系统版本的Hugo二进制文件 解压后得到 hugo_0.17_ ...

  5. Hugo + Github Pages 搭建个人博客

    尝试过 Hexo .GatsbyJs. Vuepress 搭建博客后,对这些工具最大的不满,就是运行速度以及打包速度. 后来看到 Hugo ,号称最快的静态站点生成器后. 尝试搭建博客,发现不管是运行 ...

  6. Hugo+Github 搭建个人博客(Windows环境下)

    目录 Hugo+Github 搭建个人博客(Windows环境下) 1.前言 2.Differences 2.1 https vs SSH 2.2 新建的github的仓库名必须为 用户名+githu ...

  7. 使用Hexo搭建个人博客并部署到GitHub或码云上全过程

    一.前言 如上图所示:GitHub有Github Pages,而码云也有码云 Pages 1.Github Pages或Gitee Pages是什么呢? Github Pages或者Gitee Pag ...

  8. Hexo搭建静态博客踩坑日记(一)

    前言 博客折腾一次就好, 找一个适合自己的博客平台, 专注于内容进行提升. 方式一: 自己买服务器, 域名, 写前端, 后端(前后分离最折腾, 不分离还好一点)... 方式二: 利用Hexo, Hug ...

  9. 【原】Github+Hexo+NextT搭建个人博客

    摘要 GitHub 是一个开源项目的托管网站,相信很多人都听过.在上面有很多高质量的项目代码,我们也可以把自己的项目代码托管到GitHub,与朋友们共享交流.GitHub Pages 是Github为 ...

随机推荐

  1. linux之getopts

    在编写shell脚本中,经常要处理一些输入参数,在使用过程中发现getopts更加方便,能够很好的处理用户输入的参数和参数值. getopts用于处理用户输入参数,举例说明使用方法: while ge ...

  2. WPF实战案例-MVVM模式下用附加属性在Xaml中弹出窗体

    嗯..最近回家去了,2个月没写过代码了,面试只能吹牛,基础都忘了,今天回顾一下,分享一篇通过附加属性去处理窗体弹出的情况. 或许老司机已经想到了,通过设置附加属性值,值变更的回调函数去处理窗体弹出,是 ...

  3. 【url ---lib___】笔趣阁(抓取斗罗大陆完整)和(三寸天堂)

    # coding=gbk #因为在黑屏下执行,所以代码会使用GBK url='http://www.biquge.info/10_10218/' UA={"User-Agent": ...

  4. PMM 监控 MySQL 使用钉钉告警

    打开 PMM Server 页面,如图所示点进Alerting --> Notification channels 输入钉钉的信息,并且 Save Test 测试结果,没问题了 如何使用 gra ...

  5. Nexus Repository Manager OSS 2 配置阿里云私服做代理的坑

    安装 搭建 Nexus 私服很简单,官网下载,解压: 使用管理员权限打开cmd: > cd nexus---bundle\nexus--\bin > nexus.bat install # ...

  6. PAT Advanced 1154 Vertex Coloring (25 分)

    A proper vertex coloring is a labeling of the graph's vertices with colors such that no two vertices ...

  7. ICPC2019徐州站游记

    day0 出师不利 差两分钟没赶上高铁回去我一定每天都到下边玩跑步 改签成卧铺,原来3点发7点到现在11点发9点到 本来计划火车上3个人练习一场,晚上宾馆还可以cf 结果全泡汤了,在火车站浪了一晚上 ...

  8. Peter Shirley-Ray Tracing The Next Week

    Peter Shirley-Ray Tracing The Next Week(2016) 原著:Peter Shirley 英文原著地址 密码: urji 第二本书主要介绍了运动模糊,BVH(层次包 ...

  9. 简单理解yii事件

    https://blog.csdn.net/qq43599939/article/details/80363827  通过观察者来理解yii事件 测试 class TestController ext ...

  10. MFC 可编辑文本框,MFC控件关联变量总结

    Edit Control控件,默认状态下,按回车会调用OnOK()关闭窗体.解决此bug可以,类视图中单击CMFCApplication3Dlg,下方重写OnOK(),注释掉其中的代码即可. Edit ...