Maupassant 好像一直在更新,这次重装,算是跟上了节奏。
(本篇算是写给自己的备忘)

node 降级

遇到了各种各样的报错,最后发现是因为 node 版本过高。遂重新安装 node,降至 12,官网下载 .msi 文件安装包,在卸载高版本 node 后安装即可,node -v 检查版本号。

删除 packege-lock.json

在博客的目录下删除 packege-lock.json 文件,解决 npm WARN old lockfile 报错。

hexo 命令不识别

在博客的目录下,package.json 文件内增加:

1
2
3
"hexo": {
"version": "3.9.0"
},

解决 Usage: hexo <command> 报错。

pug 和 sass 插件安装问题

  1. node-sass 安装,切换国内镜像
1
npm install -g mirror-config-china --registry=http://registry.npm.taobao.org
  1. 全局模式下安装,node-sass - npm,Node 12 对应安装 4.12+ 版本,安装特定版本命令: npm install node-sass@4.12.1 --save-dev

报错信息:

1
err: Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (93)

  1. 全局模式下安装两个渲染器

    1
    2
    npm install hexo-renderer-pug --save  
    npm install hexo-renderer-sass --save
  2. hexo -g 试着生成文件,按照报错安装更新缺失的插件,调整,直到不再报错为止

模板配置

  1. 直接对应之前的 _config.yml 修改的,可以直接把 Waline 配置进去(一般有Vercel内有3个链接,验证一下哪个地址对应评论的输入框,再填写);
  2. 下划线,参考之前的记录即可;
  3. Clustrmap 代码配置,参考之前的记录即可,Size 自定义配置先改一个数字,最后在生成的代码内修改为 1px;
  4. 中英对照,对着之前的模板配置修改。

细节修改

  1. 思源宋体增加,head.pug 增加:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    script.
    (function(d) {
    var config = {
    kitId: 'XXXXXX',
    scriptTimeout: 3000,
    async: true
    },
    h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='https://use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
    })(document);

Adobe 和 Google Fonts 都有,这次仍然沿用了 Adobe 的,不过代码都有更新。

  1. Hypothesis 配置,head.pug 增加:
    1
    2
    3
    script(type="application/json", class="js-hypothesis-config").
    {"showHighlights": false}
    script(async, src="https://hypothes.is/embed.js")

部分插件要另行安装

  1. hexo-wordcount
  2. hexo-generator-archive
  3. hexo-generator-category
  4. hexo-generator-tag

对照报错逐个安装的,记得要在 Hexo 根目录的 _config.yml 内增加:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Archives
archive_generator:
enabled: true
per_page: 50
yearly: true
monthly: true
daily: false
order_by: -date

# Categories
category_generator:
per_page: 20
order_by: -date

# Tags
tag_generator:
per_page: 20

字体

涉及 .pure-gbody 等项下,尤其 .pure-g

1
font-family: "source-han-serif-sc", serif, Helvetica, "Helvetica Neue", "Segoe UI", "Hiragino Sans GB", "Source Han Sans CN", "Microsoft YaHei", "STHeiti", "WenQuanYi Micro Hei" !important;

其他可再看效果逐项调整。

其他更新

可右键“检查”,在浏览器修改,查验展示效果,再去改 css 文件。

  • header 字体、字号
  • widget 字体、字号
  • post-title 字体、字号
  • post-content 字体
  • post-archive 字体
  • img 文件夹下的二维码
  • 根据 post.pug 修改 page.pug,删除 page.categories.length 部分和 include _partial/tag.pug 部分
  • search.pug 内 self-search,默认填写部分 placeholder='Local Search'
  • hypothesis 下划线改色 f1f1f0ebebeb

统计工具增加

Counter.dev

1
script(src="https://cdn.counter.dev/script.js", data-id="1dc6d9e4-5ed2-4b9e-bbcd-371314b176fd", data-utcoffset="8")

涉及工具

参考文章


CHANGELOG

  • 20220226 Arlmy 创建、发布
  • 20230424 Arlmy 增加 counter.dev 统计