Hugo Stack 主题配置指南

Hugo Stack 主题配置要点

目前我最喜欢的主题,响应式最多展示三列。

参考资料

exampleSite

hugo server --disableFastRender -D --contentDir themes/hugo-stack/exampleSite/content --config themes/hugo-stack/exampleSite/hugo.yaml

修复兼容性

hugo.yml 中,dataFormat 变成了对象

params:
  ...
  dateFormat:
    published: 2006-01-02
    lastUpdated: 2006-01-02 15:04

layouts/_default/rss.xml 中,把 Author.emailAuthor.name 都改成 Author

Search 无效:WARN found no layout file for "json" for layout "search" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination. 还没找到解决方案

添加头图

avatar

params:
  ...
  sidebar:
    emoji: 🍥
    subtitle: 笔记、作图、提案、个人网站 All in Obsidian
    avatar:
      enabled: true
      local: false
      src: https://all-in-obsidian.li3huo.com/img/Obsidian.svg

左侧边栏

配置 Custom Menu 以及

文章 Front Matter 中添加 menu: main,链接自动出现在左边栏。

右侧边栏

Widgets 一直没搞出来;Hugo 升级到 0.126.2 后,自己就出来了。

Rich Content

Hugo ships with several Built-in Shortcodes for rich content.

替换默认字体

Custom Header / Footer

layouts/partials/head/custom.html

<style>
    /* Overwrite CSS variable for Stack Theme */
    :root {
        --article-font-family: "LXGW WenKai Screen", var(--base-font-family);
    }
</style>

<script>
    (function () {
        const customFont = document.createElement('link');
        customFont.href = "https://npm.elemecdn.com/lxgw-wenkai-screen-webfont/style.css";

        customFont.type = "text/css";
        customFont.rel = "stylesheet";

        document.head.appendChild(customFont);
    }());
</script>

接入评论系统

https://stack.jimmycai.com/config/comments

配置说明参见 官网:公开仓库,启用 Discussions,仓库中安装 giscus app

Last updated on 2024-06-18 12:23
Built with Hugo