Hugo 主题 Stack

开源的 Hugo 的主题 Stack

概要

Stack 是 Github 上开源的一个 Hugo 的主题,其提供了模板页面,简化了 Hugo 的部分使用,仅需要简单的配置即可满足常用需求。

Stack | Card-style Hugo theme designed for bloggers (jimmycai.com)

配置

Params

description

网站描述,在 footer 位置。

mainSections

点击首页上的Home按钮时跳转的页面,默认为 [“post”],即 http://host:port/post/

rssFullContent

是否支持 rss 协议,默认为 true

favicon

Hugo 的静态文件应放置在根目录的 static 下,static下的所有文件会全部复制到编译后的根目录下,访问 url 为:http://host:port/file_name.ext

i18n

1
2
3
# Theme i18n support
# Available values: ar, bn, ca, de, el, en, es, fr, hu, id, it, ja, ko, nl, pt-br, th, uk, zh-cn, zh-hk, zh-tw
DefaultContentLanguage: zh-cn
  • ar: Arabic
  • bn: Bengali
  • ca: Catalan
  • de: German
  • el: Greek
  • en: English
  • es: Spanish
  • fa: Persian
  • fr: French
  • hu: Hungarian
  • id: Indonesian
  • it: Italian
  • ja: Japanese
  • ko: Korean
  • nl: Dutch
  • pl: Polish
  • pt-br: Portuguese
  • ru: Russian
  • th: Thai
  • tr: Turkish
  • uk: Ukrainian
  • zh-cn: Chinese (Simplified)
  • zh-hk: Chinese (Traditional) (Hong Kong)
  • zh-tw: Chinese (Traditional) (Taiwan)

Custom Menu

文件夹中创建 index.md 文件,头部添加

1
2
3
4
5
6
7
8
9
menu:
    main:
        - identifier: home
          name: Home
          url: /
          weight: -100
          params:
            icon: home
            newTab: true
  • identifier: Item ID
  • name: Display text
  • url: Link
  • weight: Priority of the item, lower value means higher priority.
  • params:
    • icon: 菜单使用的图标,在主题的 assets/icons 文件夹下。
    • newTab: Open this link in new tab

自定义头/尾

  • layouts/partials/head/custom.html
  • layouts/partials/footer/custom.html

可用配置:

1
2
3
4
5
footer:
  # copyright 时间
  since: 2020
  # 底部文字
  customText: write something... 

Article

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
article:
  # 是否支持数学公式
  math: true
  # 是否显示目录
  toc: true
  readingTime: true
  license: 
    enabled: true
    # Licensed under CC BY-NC-SA 4.0
    default: string

评论

1
2
3
comments:
  enabled: true
  provider:

provider:

  • cactus
  • cusdis
  • disqus
  • disqusjs
  • giscus
  • gitalk
  • remark42
  • twikoo
  • utterances
  • vssue
  • waline

插件

包括主页右侧的历史、搜索、分类、目录、标签云。可以配置插件是否显示和排列顺序。

详情见:Widgets | Stack (jimmycai.com)

写作

前言

用"—“包裹的 yaml 内容,配置当前页的部分属性。示例:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
title: "Hugo 主题 Stack"
aliases:
  - /p/hugo-主题-stack
date: 2023-12-05T17:56:15+08:00
description: "default"
tags: 
  - Hugo
categories: 
  - Develop
draft: false

正文

正常的 Markdown 语法

Markdown 官方教程


参考

【1】Stack | Card-style Hugo theme designed for bloggers (jimmycai.com)

【2】Markdown 官方教程

Licensed under CC BY-NC-SA 4.0
Gear(夕照)的博客。记录开发、生活,以及一些不足为道的思考……