hugo博客搭建
@ Zhang zhiyang · Sunday, Oct 11, 2020 · 2 minute read · Update at Sunday, Oct 11, 2020

0x00 环境搭建

installation

下载得到hugo.exe链接名称

# macos
brew install hugo

# linux
sudo apt/yum install hugo

配置环境变量

安装成功

λ hugo -h
hugo is the main command, used to build your Hugo site.

Hugo is a Fast and Flexible Static Site Generator
built with love by spf13 and friends in Go.

Complete documentation is available at http://gohugo.io/.

Usage:
  hugo [flags]
  hugo [command]

Available Commands:
  config      Print the site configuration
  convert     Convert your content to different formats
  deploy      Deploy your site to a Cloud provider.
  env         Print Hugo version and environment info
  gen         A collection of several useful generators.
  help        Help about any command
  import      Import your site from others.
  list        Listing out various types of content
  mod         Various Hugo Modules helpers.
  new         Create new content for your site
  server      A high performance webserver
  version     Print the version number of Hugo

0x01 创建网站

创建新站点(文件夹)

hugo new site web_blog
blog
├── archetypes  
├── config.toml //全局配置文件
├── content     //文章发布目录
├── data
├── layouts     
├── static
├── themes——|   //主题目录
            |——hugo-theme-dream———exampleSite      //模版目录
└── public      //编译发布目录

配置

cd web_blog
# 下载主题
git clone https://github.com/digitalcraftsman/hugo-agency-theme themes/hugo-theme-dream

# 本地启动
hugo server -t hugo-agency-theme --buildDrafts
Start building sites …

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

Built in 78 ms
Watching for changes in D:\hugo_blog\{archetypes,content,data,layouts,static,themes}
Watching for config changes in D:\hugo_blog\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)

# 编译生成静态网站
hugo --theme=hugo-theme-dream --baseUrl="https://geekzzy.github.io/" --buildDrafts

写文章

# 创建新文章
hugo new post/blog.md

# 

0x02 GitHub Pages

git配置

# 初始化
git init

# 添加所有文件到仓库
git add .
git commit -m "我的博客"

# 添加远程仓库源
git remote add origin https://github.com/geekzzy/gekzzy.github.io.git


//git pull origin master --allow-unrelated-histories

# 推到远程仓库的master分支
git push -u origin master

更新文章

# 本地更新
# 推送到远端
git add .
git commit -m "我的博客"
git push -u origin master

copyright

Zhang zhiyang's blog
不过是些许风霜罢了

math

© 2016 - 2020 乐此不疲

Powered by Hugo with theme Dream.

我听别人说这世界上有一种鸟是没有脚的,它只能够一直的飞呀飞呀,飞累了就在风里面睡觉,这种鸟一辈子只能下地一次,那一次就是它死亡的时候。

Social Links

copyright