0%

How to Change Hexo Themes

Change the current theme

Modify this option in _config.yml.

_config.yml
1
theme: <theme-name>    # <- change the 'theme' option to the theme name you're using

Install a theme

1
git clone <theme-repo-url> themes/<theme-name>

Remove a theme

1
git rm -rf themes/<theme-name>

Install a theme as a submodule (recommended)

1
git submodule add <theme-repo-url> themes/<theme-name>
  • Refer to this Tutorial for more details. (zh-CN)

Remove a theme as a submodule

1
2
3
4
rm -rf themes/<theme-name>
git submodule deinit -f themes/<theme-name>
rm -rf .git/modules/themes/<theme-name>
git rm -f themes/<theme-name>

Cloning an existed project with submodules

1
git clone --recursive <repo-url>

or

1
2
3
git clone <repo-url>
git submodule init # Initialize the submodules recorded in the index
git submodule update --remote # Update the submodules to match what this project expects.

Catch up with the updates of the theme

1
git submodule update --remote    # Update the submodules to match what this project expects.