Hexo v4.2.0 Release Notes

Release Date: 2019-12-22 // over 4 years ago
  • ๐Ÿ”‹ Features

    • 0๏ธโƒฃ Caching is disabled by default in hexo-server [#3963]

      • It's disabled so that any changes (particularly to the theme's layout) can be previewed in real-time.
      • If you use hexo-server in production environment to serve your website, it can be enabled by,

      _config.ymlserver: cache: true

    • โž• Add min_depth: option to toc() helper [#3997]

      • Example usage:

      <%- toc(page.content, { min_depth: 2 }) %>// table of content would only include <h2>, <h3> and above

    ๐Ÿ›  Fixes

    • ๐Ÿ”€ Merges similar theme configs in main config and theme's config [#3967]

      • For example:

      _config.ymltheme_config: a: b: 'foo'

      • Plus,

      _config.yml of themea: c: 'bar'

      • theme variable should have,

      a: { b: 'foo', c: 'bar' }

    • ๐Ÿ›  Fixes some caching issue [#3985]

    • ๐Ÿ”ง Open Graph now applies all pretty_urls options to og:url tag [#3983]

    ๐Ÿ”จ Refactor

    No longer uses lodash [#3969], [#3987], [#3753]

    • Lodash _ is still available as a global variable, usually utilized in theme layout.
    • However, we plan to completely drop it in the coming Hexo 5.0.0

    - This project page includes all the relevant pull requests which you may find useful

    Completely drops cheerio [#3850], [#3677]

    • This means Hexo no longer includes cheerio as part of its production dependencies (it's still a development dependency)
    • This also means the following initialization methods no longer work,

      const cheerio = require('./node_modules/hexo/node_modules/cheerio/index')const cheerio = require('./node_modules/cheerio/index')

    • To use cheerio,

      $ npm install --save cheerio

      const cheerio = require('cheerio')