0%

Configuration

How to configure NexT theme? The traditional approach is to edit NexT config file (thems/next/_config.yml or node_modules/hexo-theme-next/_config.yml) directly. However, the config file will be overwritten when upgrade NexT theme via git or npm, which brings inconvenience to the configuration of the theme.

At present, NexT encourages users to use the Alternate Theme Config. It's a feature of Hexo and the documentation is here: Hexo Configuration.

This tutorial shows you how to configure NexT using Alternate Theme Config. Please choose only one of the following solutions and resume next steps.

_config.[name].yml

With this way, all your theme configurations locate in config file /_config.[name].yml. Replace [name] with the value of theme option in Hexo config file. For NexT theme, the file name is _config.next.yml by default.

Usage

  1. Please ensure you are using Hexo 5.0 or later.

  2. Create a config file in site's root directory, e.g. _config.next.yml.

  3. Copy needed NexT theme options from NexT config file into this config file. If it is the first time to install NexT, then copy the whole NexT config file by the following command:

    # Installed through npm
    cp node_modules/hexo-theme-next/_config.yml _config.next.yml
    # Installed through Git
    cp themes/next/_config.yml _config.next.yml

theme_config

With this way, all your Hexo and NexT configurations locate in main Hexo config file. You don't need to edit NexT config file or create any new files. But you need to keep up indentation within theme_config option.

Usage

Copy needed NexT theme options from NexT config file into Hexo config file, then

  1. Move all these settings to the right with two spaces indentation (in Visual Studio Code: select all strings, CTRL + ]).
  2. Add theme_config: parameter above all this settings.

next.yml (Deprecated)

Older versions of NexT theme also provide another configuration method, which is to place the theme configuration in the /source/_data/next.yml file. This method is deprecated, please use _config.next.yml instead. If the /source/_data/next.yml file exists, move it to the Hexo root directory and rename it to _config.next.yml.