Hexo原主题首页文章内容全部展示,放不了几篇就拉的老长,看起来很不方便。

当发现 maupassant 这款简洁主题之后,随即花几分钟时间先进行简单替换,现将步骤记录如下:

  1. 安装主题和渲染器

    可以通过命令进行克隆,命令 git clone https://github.com/tufu9441/maupassant-hexo.git themes/maupassant

    当然也可以通过访问 github 地址 https://github.com/tufu9441/maupassant-hexo 进行下载,然后拷贝到项目的 themes 目录下解压,并将文件夹命名为 maupassant 。这是我采用的方式,具体原因不详。

    1
    2
    3
    4
    $ git clone https://github.com/tufu9441/maupassant-hexo.git themes/maupassant  ## 执行上面的步骤后,这一句不需要再执行

    $ npm install hexo-renderer-pug --save
    $ npm install hexo-renderer-dartsass --save

    编辑 Hexo 目录下的 _config.yml,将 theme 的值改为 maupassant 。此处的 maupassantthemes/maupassant 中的 maupassant 相对应。

  2. 执行生成命令

    1
    2
    3
    $ hexo clean          # 清除缓存文件 (db.json) 和已生成的静态文件 (public)。
    $ hexo generate # 生成一套静态网页
    $ hexo server # 运行测试,浏览器打开地址,http://localhost:4000
  3. 上传生成结果

    1
    $ hexo deploy         # 进行部署

完成,收工!

哪天有后记再继续写吧!

最后非常感谢大佬!

主题中文说明:https://www.haomwei.com/technology/maupassant-hexo.html