Hugo 主题
夜幕
夜幕是 Hugo 的一个极简暗色主题。演示
获取主题
安装 Hugo 和 dart-sass。
在 config.toml
中作为 hugo 模块导入
[module]
[[module.imports]]
path = 'github.com/LordMathis/hugo-theme-nightfall'
或者
手动导入
git clone https://github.com/LordMathis/hugo-theme-nightfall themes/nightfall
- 在您的
config.toml
中添加theme = "nightfall"
配置
完整示例请查看 exampleSite/config.toml
将这些参数添加到您的 config.toml
[params]
user = "hello"
hostname = "gohugo.io"
[params.author]
name = "Mr Hugo"
email = "[email protected]"
社交链接
您还可以添加社交链接。要使用社交链接的图标,您还需要将指向图标字体的链接添加到 custom-head.html
[[params.social]]
key = 0
name = "github"
url = "https://github.com/gohugoio"
icon = "fa-brands fa-github" # Add link to your icon font to `layouts/partials/custom-head.html`
target = "_blank" # Defines your target option in a-href. _blank for a new Tab for example.
aria = "GitHub Profile" # Define the aria label for accessibility like page reader - this is better for your SEO
[[params.social]]
key = 1
name = "twitter"
url = "https://www.example.com"
[[params.social]]
key = 2
name = "mastodon"
url = "https://www.example.com"
rel = "me" # You can also add rel to social link
[[params.social]]
key = 3
name = "email"
url = "mailto:[email protected]"
颜色
您可以自定义文章标题和链接颜色
[[params.styles]]
color = "orange"
使用十六进制值指定您自己的颜色,或使用预定义的颜色之一(蓝色、橙色、绿色或红色)。默认颜色为蓝色。橙色提供最佳对比度。
文章元数据
文章元数据(例如标签、发布日期和阅读时间)在文章页面上呈现。您可以在配置文件的 [params]
部分全局关闭显示发布日期和阅读时间
[params]
published = false
readingTime = false
您还可以通过在 front matter 中添加 showMetadata = false
来禁用特定页面上的元数据。
描述
要添加网站范围的描述,请将 sitedescription
添加到 config.toml
。例如
[params]
sitedescription = 'Your website description'
您还可以通过在 front matter 中添加 description
来向网站中的单个文章添加描述。例如
+++
title = 'This is the post title'
draft = false
date = 2024-01-23
description = 'This is the description'
+++
菜单
要添加菜单项,请将 [[menu.header]]
项添加到 config.toml
。例如
[menu]
[[menu.header]]
name = "posts"
weight = 0
url = "/posts"
自定义头部
要使用自定义图标、css、js 或其他资源,请创建 layouts/partials/custom-head.html
并将您的链接添加到那里。
自定义页脚
您可以使用 [params]
部分中的 footerHtml
自定义页脚中显示的文本。该值将呈现在 <span>
标签内。例如
[params]
footerHtml = 'CC-0, Built with <a href="https://gohugo.com.cn" class="footerLink">Hugo</a> and <a href="https://github.com/LordMathis/hugo-theme-nightfall" class="footerLink">Nightfall</a> theme'