Skip to content

Commit

Permalink
chore: migrate to hugo mod and configDir
Browse files Browse the repository at this point in the history
It is a recommended way and can also use different configurations in the
development and production environments.

ref: https://gohugo.io/getting-started/configuration/#configuration-directory

The theme is avaliable as a hugo mod, and some minor changes don't need
to include it, just use hugo's lookup order to override style and
config.

ref: https://gohugo.io/templates/lookup-order/

Signed-off-by: cubercsl <[email protected]>
Co-authored-by: chinggg <[email protected]>
Co-authored-by: 狗蛋日 <[email protected]>
Co-authored-by: J. Xing <[email protected]>
  • Loading branch information
4 people committed Jan 5, 2023
1 parent 9192e7e commit f59bb36
Show file tree
Hide file tree
Showing 2,719 changed files with 196 additions and 48,719 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ hugo.linux

# Temporary lock file while building
/.hugo_build.lock

# hugo mod vender
/_vendor
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
![size](https://img.shields.io/github/repo-size/shuosc/fly)

## 意见反馈

- 【腾讯文档】上海大学溯源手册意见征集📝- https://docs.qq.com/sheet/DTkF5V3VJT3lZTkhX?tab=BB08J2

---
Expand All @@ -11,7 +12,6 @@
<img src="https://user-images.githubusercontent.com/100942238/195527273-014e4aab-6603-4a27-a996-3aaea9d8b0a5.jpg" width="33%" />
</center>


---

## 如何使用
Expand All @@ -27,7 +27,6 @@
```bash
git clone https://github.com/shuosc/fly.git --depth=1
cd fly
git submodule update --init --recursive # 拉取 Hugo 主题
# 确保已安装 Hugo
hugo serve
```
Expand All @@ -42,9 +41,8 @@ hugo serve

<!--
内容可按照 `time-name-major-how-where.md` 模板准备,[点此预览](https://shuosc.github.io/fly/posts/time-name-major-how-where/)
-->


-->

为方便不熟悉计算机操作者,提供以下两种方式:

### 1️⃣ GitHub 提交
Expand All @@ -53,7 +51,7 @@ hugo serve
- 添加并编辑 Markdown 文件
- `hugo new posts/文件名.md` 或直接复制 `content/posts/` 目录下现有文件并修改
- 注意文件名规范
- 在开头添加 category/tag,方便快速检索不同专业,保研/考研/出国/工作等去向,以及 CN/US/CA/UK/SG 等上岸地区
- 在开头添加 category/tag,方便快速检索不同专业,保研/考研/出国/工作等去向,以及 CN/US/CA/UK/SG 等上岸地区
- 若有条件可在本地部署预览网页效果
- 发起 Pull Request

Expand Down
16 changes: 16 additions & 0 deletions assets/css/_custom.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

// ==============================
// Custom style
// 自定义样式
// ==============================


hr {
border-top: 1px dashed #0C3168 !important;
[data-theme='dark'] & {
border-top: 1px dashed #f8f8ff !important;

}

}

146 changes: 0 additions & 146 deletions config.toml

This file was deleted.

9 changes: 9 additions & 0 deletions config/_default/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title = 'SHUFly - 上海大学溯源手册'
# canonifyURLs = true # Fix GitHub Pages wrong path

# [en, zh-cn, fr, ...] 设置默认的语言
defaultContentLanguage = "zh-cn"
# 网站语言,仅在这里 CN 大写
languageCode = "zh-CN"
# 是否包括中日韩文字
hasCJKLanguage = true
3 changes: 3 additions & 0 deletions config/_default/frontmatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 设置自动更新修改时间
date = [':git', 'lastmod', ':default']
lastmod = [':fileModTime', ':git', 'lastmod', ':default']
27 changes: 27 additions & 0 deletions config/_default/markup.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Hugo 解析文档的配置
# 语法高亮设置 (https://gohugo.io/content-management/syntax-highlighting)
[highlight]
codeFences = true
guessSyntax = true
lineNos = true
lineNumbersInTable = true
# false 是必要的设置
# (https://github.com/dillonzq/LoveIt/issues/158)
noClasses = false
# Goldmark 是 Hugo 0.60 以来的默认 Markdown 解析库
[goldmark]
[goldmark.extensions]
definitionList = true
footnote = true
linkify = true
strikethrough = true
table = true
taskList = true
typographer = true
[goldmark.renderer]
# 是否在文档中直接使用 HTML 标签
unsafe = true
# 目录设置
[tableOfContents]
startLevel = 2
endLevel = 6
53 changes: 53 additions & 0 deletions config/_default/menu.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 中文菜单配置
[[main]]
identifier = "posts"
# 父级菜单项的标识符 (identifier) since v0.2.14
parent = ""
# 你可以在名称 (允许 HTML 格式) 之前添加其他信息, 例如图标
pre = "<i class='fa-solid fa-archive fa-fw fa-sm'></i>"
# 你可以在名称 (允许 HTML 格式) 之后添加其他信息, 例如图标
post = ""
name = "所有文章"
url = "/posts/"
title = ""
weight = 1
[[main]]
identifier = "categories"
pre = "<i class='fa-solid fa-th fa-fw fa-sm'></i>"
post = ""
name = "分类"
url = "/categories/"
title = ""
weight = 2
[[main]]
identifier = "tags"
pre = "<i class='fa-solid fa-tags fa-fw fa-sm'></i>"
post = ""
name = "标签"
url = "/tags/"
title = ""
weight = 3
[[main]]
identifier = "friends"
pre = "<i class='fa-solid fa-users fa-fw fa-sm'></i>"
post = ""
name = "友链"
url = "/friends/"
title = "友情链接"
weight = 4
[[main]]
identifier = "about"
pre = "<i class='fa-solid fa-info-circle fa-fw fa-sm'></i>"
post = ""
name = "关于"
url = "/about/"
title = ""
weight = 5
[[main]]
identifier = "github"
pre = "<i class='fa-brands fa-github fa-fw'></i>"
post = ""
name = ""
url = "https://github.com/shuosc/fly"
title = "GitHub"
weight = 6
2 changes: 2 additions & 0 deletions config/_default/module.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[[imports]]
path = "github.com/hugo-fixit/FixIt"
39 changes: 39 additions & 0 deletions config/_default/params.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# FixIt 主题版本
version = "0.2.X"
# Header config
[header]
# FixIt 0.2.13 | CHANGED desktop header mode ("sticky", "normal", "auto")
desktopMode = "sticky"
# FixIt 0.2.13 | CHANGED mobile header mode ("sticky", "normal", "auto")
mobileMode = "auto"
# FixIt 0.2.0 | NEW Header title config
[header.title]
# URL of the LOGO
logo = "/shugug.webp"
# title name
name = "SHUFly"

# 中文主页信息设置
[home]
# RSS 文章数目
rss = 10
# 主页个人信息
[home.profile]
enable = true
# Gravatar 邮箱,用于优先在主页显示的头像
gravatarEmail = ""
# 主页显示头像的 URL
avatarURL = "/shufly.webp"
# 主页显示的网站标题 (支持 HTML 格式)
title = "上海大学溯源手册"
# 是否为副标题显示打字机动画
typeit = true
# 是否显示社交账号
social = false
# 免责声明 (支持 HTML 格式)
disclaimer = ""
# 主页文章列表
[home.posts]
enable = true
# 主页每页显示文章数量
paginate = 8
3 changes: 3 additions & 0 deletions config/production/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 生产环境时需要进行修改的配置
baseURL = 'https://shuosc.github.io/fly'
canonifyURLs = true # Fix GitHub Pages wrong path
30 changes: 30 additions & 0 deletions config/production/params.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 生产环境时开启页面的评论
[page.comment]
enable = true
# FixIt 0.2.16 | CHANGED Waline comment config (https://waline.js.org)
[page.comment.waline]
enable = true
serverURL = "https://shuosc-comments.xyz/"
pageview = false # FixIt 0.2.15 | NEW
emoji = [
"https://unpkg.com/@waline/[email protected]/bmoji",
"https://unpkg.com/@waline/[email protected]/qq",
"https://unpkg.com/@waline/[email protected]/alus",
"//unpkg.com/@waline/[email protected]/weibo",
]
# meta = ["nick", "mail", "link"]
requiredMeta = ["mail"]
# login = "enable"
wordLimit = 1000
# pageSize = 10
# imageUploader = false # FixIt 0.2.15 | NEW
highlighter = true # FixIt 0.2.15 | NEW
comment = false # FixIt 0.2.15 | NEW
texRenderer = true # FixIt 0.2.16 | NEW
search = false # FixIt 0.2.16 | NEW
# recaptchaV3Key = "" # FixIt 0.2.16 | NEW

# FixIt 0.2.12 | NEW Busuanzi count
[ibruce]
enable = true
enablePost = false
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/shuosc/fly

go 1.19

require github.com/hugo-fixit/FixIt v0.2.16 // indirect
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/hugo-fixit/FixIt v0.2.16 h1:f6uCrlFwtPtkhfB8L7AbRPdMMpr/MVXvEy70qTGNzSo=
github.com/hugo-fixit/FixIt v0.2.16/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU=
Loading

0 comments on commit f59bb36

Please sign in to comment.