Hugo 主题
hugo-pure
English|中文
一个简单干净的 Hugo 主题,在线演示:https://hugo-pure.undus.net
功能
响应式设计(移动设备支持)
暗黑模式支持(自动切换)
多语言支持
无 Javascript
禁止 AI 爬虫 (robots.txt)
有用的自定义 front matter
用法
# Clone theme to your own project
$ git submodule add https://github.com/undus5/hugo-pure themes/hugo-pure
# Add theme to your project's config file
$ echo "theme = 'hugo-pure'" >> config.toml
# Or you can run demo directly
$ cd hugo-pure
$ ./demo.sh run
自定义 Front Matter
列表页 (_index.md)
+++
paginate = 1 # number of posts per page
doubleColumns = true # list style, also available in global hugo.toml
+++
单页
+++
showToc = true # enable table of contents
showSummary = true # show summary on list
type = "hidden" # hidden from any list (home, section, rss)
subtitle = "Foo Bar" # subtitle (contributed by @carmenbianca, thanks)
# add external source links beside tags
[[sources]]
title = "Source1"
url = "https://gohugo.com.cn/documentation/"
[[sources]]
title = "Source2"
url = "https://gohugo.com.cn/about/"
+++
自定义
网站图标
网站图标默认是空的,如果需要,请将一个图标放入您项目中的 assets/favicon.png
,它将被自动加载。
CSS & JS
如果您想覆盖 CSS 或添加 JS,只需在您自己的项目中创建一些具有特定块名称的部分模板,例如
layouts/partials/mycss.html
{{ define "css" }}
<style> ... </style>
{{ end }}
layouts/partials/myjs.html
{{ define "js" }}
<script> ... </script>
{{ end }}
或者 layouts/partials/myassets.html
, assets/mystyle.css
, assets/myscript.js
{{ define "css" }}
{{- $css := slice }}
{{- $css = $css | append (resources.Get "mystyle.css") }}
{{- $css = $css | resources.Concat "mystyle.bundle.css" }}
{{- $css = $css | resources.Minify }}
<link rel="stylesheet" href="{{- $css.RelPermalink -}}">
{{ end }}
{{ define "js" }}
{{- $js := slice }}
{{- $js = $js | append (resources.Get "myscript.css") }}
{{- $js = $js | resources.Concat "myscript.bundle.css" }}
{{- $js = $js | resources.Minify }}
<script src="{{- $js.RelPermalink -}}"></script>
{{ end }}