Hexo主题cactus的改修

在使用Hexo中遇到了主题的问题,也遇到了不熟悉Hexo命令等问题,都记录在此。

主题选择了一款轻量型主题cactus,比较简单明确。

不过该主题不支持中文,需要自己将代码clone下来进行更改。
选择此主题时,按照github的教程是将其作为git的submodule来使用,所以无法更改。

若要进行自定义,需删除submodule,再将clone下来的项目放进themes

1
2
3
git rm --cached themes/cactus 
git rm .gitmodules
rm -rf themes/cactus/.git
  • 修改nav字号

    1
    2
    3
    4
    5
    6
    7
    // themes/cactus/source/css/_partial/header.styl
    #nav
    color: $color-accent-1
    letter-spacing: .01em
    font-weight: 200
    font-style: normal
    font-size: 1.2rem
  • 追加字体
    cactus/source/lib 中创建 fonts 文件夹,并加入JetBrains Mono字体
    如果需要支持中文请将字体替换为中文字体
    themes/cactus/source/css/_fonts.styl

    1
    2
    3
    4
    5
    @font-face
    font-style: normal
    font-weight: normal
    font-family: "JetBrains Mono"
    src: url("../lib/fonts/JetBrainsMono-Regular.ttf") format("truetype")
  • 修改字体
    themes/cactus/source/css/_variables.styl

    1
    2
    3
    4
    5
    6
    // 
    // Fonts
    $font-family-body = "JetBrains Mono", monospace
    $font-family-mono = "JetBrains Mono", monospace
    $font-size = 1rem
    ...