Currently, it is not smooth to update NexT theme from pulling or downloading new releases. It is quite often running into conflict status when updating NexT theme via git pull
, or need to merge configurations manually when upgrading to new releases.
At present, NexT encourages users to store some options in site's /_config.yml
and other options in theme's /themes/next/_config.yml
. This approach is applicable, but has some drawbacks:
- Configurations are splitted into two pieces
- Users may be confused which place should be for options
In order to resolve this issue, NexT provides the following two solutions.
With this way, all your configurations locate in main Hexo config file (/_config.yml
), you don't need to touch /themes/next/_config.yml
or create any new files. But you must preserve double spaces indents within theme_config
option.
If there are any new options in new releases, you just need to copy those options from /themes/next/_config.yml
, paste into /_config.yml
and set their values to whatever you want.
- Please confirm that the
/source/_data/next.yml
file does not exist (delete it if exists). - Copy needed NexT theme options from theme's
/themes/next/_config.yml
into/_config.yml
, then
2.1. Move all this settings to the right with two spaces (in Visual Studio Code: select all strings, CTRL + ]).
2.2. Addtheme_config:
parameter above all this settings.
With this way, you can put all your configurations into one place (/source/_data/next.yml
), you don't need to touch /themes/next/_config.yml
.
But option may not accurately procces all hexo external libraries with their additional options (for example, hexo-server
module options may be readed only in default hexo config).
If there are any new options in new releases, you just need to copy those options from /themes/next/_config.yml
, paste into /source/_data/next.yml
and set their values to whatever you want.
This method relies on Hexo Data files. Because Data files is introduced in Hexo 3, so you need upgrade Hexo to 3.0 (or above) to use this feature.
- Please ensure you are using Hexo 3 (or above).
- Create an file named
next.yml
in site's/source/_data
directory (create_data
directory if it does not exist).
And after that steps there are 2 variants, need to choose only one of them and resume next steps.
-
Variant 1:
override: false
(default):- Check your
override
option in default NexT config, it must set onfalse
.
Innext.yml
it must not be defined or set onfalse
too. - Copy needed options from both site's
/_config.yml
and theme's/themes/next/_config.yml
into/source/_data/next.yml
.
- Check your
-
Variant 2:
override: true
:- In
next.yml
setoverride
option ontrue
. - Copy all NexT theme options from theme's
/themes/next/_config.yml
into/source/_data/next.yml
.
- In
- Then, in main site's
/_config.yml
need to definetheme: next
option (and if needed,source_dir: source
). - Use standard parameters to start server, generate or deploy (
hexo clean && hexo g -d && hexo s
).