ramlife

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

安装 go

先在 https://go.dev/doc/install 下载压缩包,然后进行安装

rm -rf /usr/local/go && tar -C /usr/local -xzf go1.19.5.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go version

后面还需要修改 bashrc,修改环境变量。

安装 hugo

sudo snap install hugo

quickstart

生成一个最简单的网页

hugo new site quickstart
cd quickstart
git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke themes/ananke
echo "theme = 'ananke'" >> config.toml
hugo server

第一个测试文章

  • 生成
hugo new posts/my-first-post.md
  • 修改, vim content/posts/my-first-post.md 添加以下内容
## Introduction

This is **bold** text, and this is *emphasized* text.

Visit the [Hugo](https://gohugo.io) website!
  • 因为上面是草稿,想要看到草稿需要允许草稿启动 hugo server --buildDrafts 或者 hugo server -D

配置文件修改

config.toml 这个里面可以修改网站基本的一些设置。

生成

hugo 就可以生成所需文件,放在 public 文件夹下。 可以浏览器打开这个文件夹下的 index.html 来查看。

参考:

Download and install
https://go.dev/doc/install

Install Hugo on Linux.
https://gohugo.io/installation/linux/

gohugo-theme-ananke
https://github.com/theNewDynamic/gohugo-theme-ananke

Basic usage
https://gohugo.io/getting-started/usage/#draft-future-and-expired-content

Quick Start
https://gohugo.io/getting-started/quick-start/

posted on 2023-01-17 18:52  ramlife  阅读(188)  评论(0编辑  收藏  举报