How to configure NexT theme? The traditional approach is to edit NexT config file (
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.
With this way, all your theme configurations locate in config file
[name] with the value of
theme option in Hexo config file. For NexT theme, the file name is
_config.next.yml by default.
Please ensure you are using Hexo 5.0 or later.
Create a config file in site’s root directory, e.g.
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
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
Copy needed NexT theme options from NexT config file into Hexo config file, then
- Move all these settings to the right with two spaces indentation (in Visual Studio Code: select all strings, CTRL + ]).
theme_config:parameter above all this settings.
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