Skip to content

gentoo-zh/gentoozh-theme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gentoozh-theme

Gentoo 中文社区官网(gentoozh.org)的 Hextra 补丁包。

这不是从零写的主题,也不是 fork,而是在 Hextra 之上叠加本站定制的一层「补丁包」:用 Hugo Module 的查找顺序让这里的文件覆盖或扩展 Hextra,同时跟随上游 Hextra 的更新与 bug 修复。

里面有什么

只放「皮」(表现层),都是本站相对 Hextra 的覆盖或新增:

  • 首页 bento 布局 —— layouts/shortcodes/home-bento.html(hero + 入口磁贴 + 社区/最新文章/贡献者带)
  • 贡献者页 —— layouts/contributors/{list,single}.html + layouts/_partials/home-avatar.html(头像墙)
  • 点击复制 —— layouts/shortcodes/copy.html + layouts/_partials/custom/head-end.html(无脚本可降级)
  • 定制 404、footer、navbar 标题 —— layouts/404.htmllayouts/_partials/{footer,navbar-title}.html(footer 正文在 custom/footer.htmlfooter.html 只是薄壳)
  • 文章/列表卡片 —— layouts/_default/list.htmllayouts/blog/list.html
  • Gentoo 品牌紫等站点样式 —— assets/css/custom.css(叠在 Hextra 编译产物之上)
  • 三语 UI 字串 —— 自定义键在 i18n/{zh-cn,zh-tw,en}.toml(简 / 正 / 英各一套);覆盖 Hextra 核心键在 i18n/{zh-cn,zh-tw}.yaml(英文核心键走 Hextra 自带)。站点 UI 已支持简 / 正 / 英三语。

站点内容(content/,含 sync 生成的正体)、配置(菜单/语言/params)、sync_to_tw.sh、贡献者抓取脚本等都留在站点仓库,那些不是「皮」。

怎么用

依赖链:站点 → gentoozh-theme → Hextra(前者覆盖后者)。站点的 hugo.toml

[module]
  [[module.imports]]
    path = "github.com/Gentoo-zh/gentoozh-theme"

升级上游 Hextra

本仓库做(不在站点):

hugo mod get -u github.com/imfing/hextra
hugo mod tidy
git commit -am "bump hextra"
git tag vX.Y.Z          # 打个新版本

然后到站点仓库把本模块 pin 到新版本(hugo mod get github.com/Gentoo-zh/gentoozh-theme@vX.Y.Z)。

本地开发

在站点 go.modreplace,指向本仓库工作副本,免发版即可联调:

replace github.com/Gentoo-zh/gentoozh-theme => ../gentoozh-theme

升级 Hextra 时要复查的「影子覆盖」文件

这几个文件复制并改写了 Hextra 同名文件,升级 Hextra 后建议 diff 一下上游是否有变动: layouts/404.htmllayouts/_default/list.htmllayouts/blog/list.htmllayouts/_partials/footer.htmllayouts/_partials/navbar-title.html。 其余(home-bentocopyhome-avatarcontributors/*)是全新增、custom/footercustom/head-endcustom.css 走官方扩展点,均不与上游冲突。

许可

代码 MIT

About

Gentoo 中文社区官网的 Hextra 补丁包(在 Hextra 之上叠加 layouts/样式/i18n,跟随上游更新)

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors