Hugo
@ Zhang zhiyang · Saturday, Oct 1, 1949 · 2 minute read · Update at Saturday, Oct 1, 1949

雄关漫道真如铁,
而今迈步从头越。
从头越,
苍山如海,残阳如血。

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

# 文章属性
title: xxx
date: 2021-01-12T23:54:31+08:00
lastmod: 2021-01-12T23:54:31+08:00
author: geeekzzy
avatar: /me/yy.jpg
cover: 文件路径
categories:
  - xxx
tags:
  - xxx
  - xxx

0x02 GitHub Pages

git配置

# 初始化
git init

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

# 添加远程仓库源
git remote add origin https://github.com/geekzzy/geekzzy.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
Zhang zhiyang's blog
不过是些许风霜罢了
c cyber http linux math mysql php python 前端

© 2016 - 2022 Zhangzhiyang的博客

Powered by Hugo with theme Dream.

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

日程

Zhangzhiyang的 ❤️ 博客

其他

如果你喜欢我的开源项目或者它们可以给你带来帮助,可以赏一杯咖啡 ☕ 给我。~

If you like my open source projects or they can help you. You can buy me a coffee ☕.~

PayPal

https://paypal.me/g1eny0ung

Patreon

Become a Patron!

微信赞赏码

wechat

最好附加一下信息或者留言,方便我可以将捐助记录 📝 下来,十分感谢 🙏。

It is better to attach some information or leave a message so that I can record the donation 📝, thank you very much 🙏.