Tags:
参考资料
exampleSite
git submodule add https://github.com/zhaohuabing/hugo-theme-cleanwhite.git themes/cleanwhite
config.yaml -> clean-white.yaml
hugo server --disableFastRender -D --contentDir themes/cleanwhite/exampleSite/content --config clean-white.yaml
修复 Content Type 兼容性:post -> posts
Hugo content type 由 front matter.type(P0) 和 content 下对应的子目录(P1) 决定。^[content 根目录下的类型是 page]
找到锁死 content type
为 “post” 的模版
$ grep post\" themes/cleanwhite/layouts/* -r
themes/cleanwhite/layouts/_default/archive.html:{{ $pages := (where (where .Site.Pages "Type" "post") "IsPage" true) }}
themes/cleanwhite/layouts/partials/category.html:{{ $paginator := .Paginate (where .Data.Pages "Section" "post") }}
themes/cleanwhite/layouts/partials/portfolio.html:{{ $paginator := .Paginate (where (where .Site.Pages "Type" "post") "IsPage" true) }}
Search 无效问题 themes/cleanwhite/static/js/jquery.js
适配菜单
- 🔍
- ARCHIVE
content/menu/archive
:type: archive
params:
...
addtional_menus:
- title: ARCHIVE
href: /menu/archive/
替换搜索工具
- https://github.com/replicatedhq/hugo-algolia
- https://github.com/cloudcannon/pagefind
- Add Search To A Hugo Site # 最后采用的方案
params:
...
algolia_search: false
layouts/_default/search.html
layouts/_default/index.json
替换默认字体
static/css/hugo-theme-cleanwhite.min.css
@import url('https://npm.elemecdn.com/lxgw-wenkai-screen-webfont/style.css');
body {
font-family: "LXGW WenKai Screen", sans-serif;
}
h1, h2, h3, h4, h5, h6 {
font-family: "LXGW WenKai Screen", "raleway", sans-serif;
margin: 0;
padding: 0;
font-weight: 400;
}
cp static/css/hugo-theme-cleanwhite.min.css public/css
头图
params:
...
header_image: /photos/202403171612965.png
sidebar_avatar: /photos/202403191629989.png