ef 用code first 添加字段_如何用 hugo 搭建个人博客

安装搭建个人博客

安装Hugo
  • 官方教程
  • Mac安装方式
    • brew install hugo
    • Hugo version (显示版本号)——检测是否安装成功
  • Window

673b001b9c196b62c77439a4a6f0e7c8.png
转自饥人谷——方方

快速搭建博客

查看官方文档
  • 进入Higo官方,点击Quick Start快速开始
  • 自行安装 [从Step2(第二步)开始到Step7(第七步)]
按照以下步骤 (* 为注释

Step1

首先建立一个新目录/文件夹(建议路径都用英文)

使用编辑器(这里推荐VSCode)开启终端输入命令:

hugo new site quickstart
* quickstart 改为 xxx.github.io-generator  xxx为GitHub账户名字

Step2

终端输入命令:

code xxx.github.io-generator * 使用编辑器打开新生成的目录,注意code要配置path文件

git init

git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke

echo 'theme = "ananke"' >> config.toml

Step3

终端输入命令:

hugo new posts/my-first-post.md
* my-first-post 改下名字 开博大吉

窗口显示:

---
title: "My First Post"   * My First Post 改下名字 博客大吉
date: 2019-03-26T08:47:11+01:00
draft: true   * true 改为 false (更改为不是草稿)
---

Step4

终端输入命令:

 hugo server -D

终端显示:

                   | EN
+------------------+----+
  Pages            | 10
  Paginator pages  |  0
  Non-page files   |  0
  Static files     |  3
  Processed images |  0
  Aliases          |  1
  Sitemaps         |  1
  Cleaned          |  0

Total in 11 ms
Watching for changes in /Users/bep/quickstart/{content,data,layouts,static,themes}
Watching for config changes in /Users/bep/quickstart/config.toml
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)  * 注意 http://localhost:1313/ 为新生成的博客网址
Press Ctrl+C to stop

Step5

编辑器按下 ctrl+p 调出命令区域

输入:

config.toml 

窗口显示:

baseURL = "https://example.org/"
languageCode = "en-us"   * en-us 改为 zh-Hans
title = "My New Hugo Site"  * My New Hugo Site 改下名字 xx的博客
theme = "ananke"

Step6

终端输入:

hugo -D

生成一个新的public文件(public文件为我们博客的站点)

在编辑器下新建.gitignore文件(.gitignore未不提交文件),在文件里输入/public/ (public需要自己重新生成新仓库,所以需要通过.gitignore不提交public文件)

Step7

终端输入:

cd public

git init 

git add .

git commit -v 

Step8

在GitHub下新建仓库,仓库名字必须为:xxx.github.io (xxx与之前输入GitHub用户名一致)

终端输入:

git remote add origin git@github.com:Xxx/xxx.github.io.git

git push -u origin master

Step9

进入GitHub的新建仓库,打开settting(设置),往下拉找到 GitHub Pages 一栏,出现的链接为个人博客的地址

到此hugo个人博客建立完成!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值