简单使用Hugo搭建网站
侧边栏壁纸
  • 累计撰写 42 篇文章
  • 累计收到 82 条评论
  • 今日撰写 0 篇文章

简单使用Hugo搭建网站
2022-07-13 / 0 评论 / 664 阅读 / 1 点赞

简单使用Hugo搭建网站

绎泽
2022-07-13 / 0 评论 / 664 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2022年07月13日,已超过745天没有更新,若内容或图片失效,请留言反馈。

Hugo是基于Go语言开发的静态网站生成器,特点就是快

安装

二进制文件安装(由官方编译完成的二进制文件来安装,推荐使用,用源码容易出现问题)

https://github.com/gohugoio/hugo/releases

源码安装

git clone https://github.com/gohugoio/hugo.git

cd hugo

go install

检查是否安装完成 hugo -v,如果需要支持SASS/SCSS,请添加--tags extended参数,不过在这之前需要CGO的依赖(或者使用hugo_extended版本)

如果没安装CGO,请先安装CGO,这里使用的是mingw64,CGO_ENABLED环境变量为1

生成站点

hugo new site ./www

创建文章(默认自动生成md文件到content文件夹中,可选择目录)

hugo new post/hallo.md

如果没有显示文章的话,请将文章的draft字段改为false,因为这个是草稿,草稿是不会显示在页面上的

安装主题

git clone https://github.com/miiiku/hugo-theme-kagome.git ./themes/kagome

修改config.toml文件

baseURL = 'https://blog.tencent-qq.cn'
languageCode = 'zh-CN'
title = '绎泽小窝'
theme = "kagome"

启动Hugo服务器

hugo server

访问http://localhost:1313

如果报错,you need the extended version to build SCSS/SASS的话,请使用extended版本

部署到github pages

hugo  --baseUrl="http://yizeblog.github.io/"

如果该命令执行成功,会将静态页面生成到public文件夹中,只需要push该文件夹到github上就好了

本文共 249 个字数,平均阅读时长 ≈ 1分钟
广告
1

海报

正在生成.....

评论 (0)

取消

Warning: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /www/wwwroot/blog/usr/themes/Joe-master/public/footer.php on line 25

Warning: file_get_contents(): Failed to enable crypto in /www/wwwroot/blog/usr/themes/Joe-master/public/footer.php on line 25

Warning: file_get_contents(https://api.vore.top/api/IPdata?ip=156.238.229.100): failed to open stream: operation failed in /www/wwwroot/blog/usr/themes/Joe-master/public/footer.php on line 25