Build Status 演示

Sam

一个简单极简的主题,专注于排版和内容。

hugo-theme-samZola 移植版。

截图

原作

这是 Hugo 主题 hugo-theme-sam (许可证) 的移植版。

参见 upstream 了解源代码来源。

安装

安装此主题最简单的方法是克隆它...

git clone https://github.com/janbaudisch/zola-sam.git themes/sam

... 或者将其用作子模块。

git submodule add https://github.com/janbaudisch/zola-sam.git themes/sam

无论哪种方式,你都必须在 config.toml 中启用该主题。

theme = "sam"

分类法

Sam 支持 tagsauthors 分类法。

要使用它们,请在 config.toml 中声明它们:

taxonomies = [
    { name = "tags", rss = true },
    { name = "authors", rss = true }
]

在你的页面 Front Matter 中设置它们:

[taxonomies]
tags = ["some", "tag"]
authors = ["Alice", "Sam"]

有关更多详细信息,请参阅 Zola 文档

选项

有关示例配置,请参阅 config.toml

菜单

首页上的菜单创建如下:如果设置了 sam_menu 变量,则使用它。

[extra]
sam_menu = [
    { text = "posts", link = "/posts" },
    { text = "about", link = "/about" },
    { text = "github", link = "https://github.com" }
]

如果未设置,则会链接 content 下的所有版块。

底部菜单

此变量决定菜单(如上所述)是否也会显示在页面底部。

默认值:false

[extra]
sam_bottom_menu = true

home

设置菜单和 404 页面中指向首页的所有链接的名称。

默认值:home

[extra]
home = "home"

日期格式

指定如何显示日期。格式在 这里 描述。

默认值:%a %b %e, %Y

[extra]
date_format = "%a %b %e, %Y"

字数统计和阅读时间

你可以为整个网站的文章启用或禁用字数统计和阅读时间:

默认值:true (两者)

[extra]
show_word_count = true
show_reading_time = true

如果启用,你可以通过 Front Matter 在每个页面上选择退出:

默认值:false (两者)

+++
[extra]
hide_word_count = true
hide_reading_time = true
+++

禁用页面页眉

如果你想禁用页面的完整页眉(例如明确不是文章的页面),你可以通过 Front Matter 这样做:

默认值:false

+++
[extra]
no_header = true
+++

页脚

要在页面末尾放置一些文本,请设置以下内容:

[extra.sam_footer]
text = "Some footer text."