Hexo 4.0.0 发布

要升级到 Hexo v4,请更改 package.json 中的以下行:

-  "hexo": "^3.9.0",
+ "hexo": "^4.0.0",

重大更改

  • chore: 移除 Node 6 #3598
  • fix post_link, asset_link 当标题包含未转义的 html 字符时 #3704
    • 影响 asset_link, post_link 标签插件
    • 如果您想保留未转义的字符,请将 false 设置为最终参数 {% asset_link 'filename 'title' 'false' %}
  • fix: 默认情况下对永久链接进行编码 #3708
    • 如果您目前使用 encodeURI(post.permalink)(包括页面、标签和类别变量的 permalink),则有三种选择
      1. 使用 encodeURI(decodeURI(post.permalink)) 保持与 hexo v3.9(及更早版本)的向后兼容性
      2. 使用 encodeURL() 函数,它是由 hexo-util 提供的,它向后兼容
      3. 删除 encodeURI() 函数,这会破坏向后兼容性
    • 如果您想以解码形式使用这些变量,
    • 此更改不适用于 this.url 变量。
  • fix(paginator): 添加 escape 选项以与 hexo-util 1.3.0 兼容 #3728
    • 主题开发者,如果您使用 html 自定义 prev_text/next_text(例如插入图标),则需要在参数中设置 escape: false

功能

  • feat(filter): 尽可能使用现有摘要 #3612

  • 将 minimatch 切换到 micromatch #3538

  • feat: 添加选项以禁用 meta generator 标签 #3653

    • 在 config 中添加 meta_generator: false 以禁用
  • feat(generator): 允许限制并行生成 #3665

    • 如果您遇到“内存不足”问题,请尝试降低 hexo g --concurrency <number> 中的值
  • 使用日期而不是文件修改时间作为更新日期的选项 #3235

    • 如果您不希望在 post.updated 变量中使用文件修改时间,请在 config 中设置 use_date_for_updated: true
  • feat(list_tags): 添加 Schema “keywords” 和 Microdata “tag” #3678

  • feat(permalink_variable): 添加 pretty_urls 选项以从 url 中删除 index.html #3691

    • 使用以下 config 从 permalink 变量 中删除尾随的 index.html
    pretty_urls:
    trailing_index: false
    • 不适用于 this.url 变量(请参阅 #3661)。
    • 应该与现有的 canonical 相关插件兼容,建议插件和主题开发者进行测试
  • feat: 添加 full_url_for 帮助器 #3701

    • 使用此帮助器 full_url_for(page.path) 代替 config.url + page.path
  • fix: external_link 应该使用 after_render #3675

    • 添加了 fieldexclude 选项,请参阅 #3675 获取指南。

性能

  • perf(meta_generator): 删除 cheerio #3671
  • perf(open_graph): 删除 cheerio 并使用正则表达式 #3680
  • perf(external_link): 删除 cheerio 并使用正则表达式 #3685
  • perf(cache): 在所有模式下强制缓存 #3756

修复

  • fix: 将英语设置为默认语言 #3654
  • 在 front-matter 中未指定标题时使用文件名 #3672
  • fix: 忽略文章数为零的类别/标签 #3624
  • fix(open_graph): 从 url 中删除 index.html #3661
  • fix(open_graph): 删除重复的 twitter card 标签 #3668
  • fix(helpers, tag plugins): 默认情况下对 url 进行编码 #3710
    • 有关解码指南,请参阅 #3708
  • fix(open_graph): 对 url 进行百分比编码,而不是进行 html 转义 #3686
  • fix: 允许 “blockquote” 标签插件中的反引号代码块 #2321
  • fix: 正确处理 blockquote 上的反引号代码块 #3765
  • fix: 阻止将额外的换行符插入反引号代码块的末尾 #3768

依赖项

  • chore(deps): 将 tildify 依赖项从 ^1.2.0 更新到 ^2.0.0 #3541
  • chore(deps): 将 strip-indent 依赖项从 ^2.0.0 更新到 ^3.0.0 #3534
  • chore(deps-dev): 将 husky 依赖项从 ^1.1.3 更新到 ^3.0.0 #3608
  • chore(deps-dev): 将 eslint 依赖项从 ^5.9.0 更新到 ^6.0.1 #3606
  • chore(deps-dev): 将 lint-staged 依赖项从 ^8.1.0 更新到 ^9.1.0 #3615
  • chore: 更新到 hexo-util 1.0.1 和 hexo-renderer-marked 2.0.0 #3646
  • chore(deps): 将 hexo-i18n 依赖项从 ^0.2.1 更新到 ^1.0.0 #3698
  • chore(deps): 将 hexo-fs 依赖项从 ^1.0.0 更新到 ^2.0.0 #3699
  • chore(deps): 将 hexo-front-matter 依赖项从 ^0.2.3 更新到 ^1.0.0 #3700
  • chore(deps): 将 hexo-log 依赖项从 ^0.2.0 更新到 ^1.0.0 #3730
  • chore(deps): 将 warehouse 依赖项从 ^2.2.0 更新到 ^3.0.0 #3736
  • chore(deps): 将 hexo-cli 从 2.0.0 提升到 3.0.0 #3743