安装及主题配置

  1. 推荐使用 scoop 安装 Hugo

    # 普通版
    scoop install hugo
    # 扩展版
    scoop install hugo-extended
    

    在后续使用过程中,如果出现以下报错,可以通过安装扩展版解决。 [1]

    error: failed to transform resource: TOCSS: failed to transform "scss/main.scss" (text/x-scss): this feature is not available in your current Hugo version
    
  2. 生成站点

    hugo new site path/to/your/blog

  3. 安装主题 MemE [2]

    # 安装
    cd blog
    git init
    git submodule add https://github.com/reuixiy/hugo-theme-meme.git themes/meme
    
    # 更新
    git submodule update --rebase --remote
    
  4. 配置主题

    1. 替换 config.toml

      打开站点文件夹,然后将 Hugo 默认生成的 config.toml 删除,再进入 themes/meme/config-examples/zh-cn/ 目录,将 MemE 提供的 config.toml 复制到站点根目录下

    2. 新建文章

      hugo new "posts/hello-world.md"
      hugo new "about/_index.md"
      
    3. 体验测试

      hugo server -D
      

个性化

根据配置文件中的注释安装自己的需要配置即可,下面着重介绍下“品牌栏”的配置。

这个流程走下来,brand 就做好了,接下来把它用到主题中。

打开你的 SVG文件,给它添加一个名为 brandclass,比如:

# 修改前
- <svg xmlns="http://www.w3.org/2000/svg">
# 修改后
+ <svg xmlns="http://www.w3.org/2000/svg" class="brand">

接下来,在站点的 data 文件夹内新建一个 SVG.toml 文件,并添加一行:

brand = ''

最后,将你的 SVG 粘贴进 '' 内即可。

参考文档

Hugo 主题 MemE 文档


  1. https://gohugo.io/troubleshooting/faq/#i-get-tocss--this-feature-is-not-available-in-your-current-hugo-version ↩︎

  2. https://github.com/reuixiy/hugo-theme-meme/blob/master/README.zh-cn.md ↩︎