How to create a custom homepage in Hexo
When converting my blog from Jekyll to Hexo, Hexo ignored my custom homepage. It took me a while to find out to solve this, so hopefully this post will save you some time.
The solution
By default, Hexo ignores a custom homepage if you place it in /source/index.md
. By default, you can add a page as a partial but that’s not a very elegant way to solve the issue.
If you’re using Hexo 3 like I do, you can solve this by removing the hexo-generator-index package. By default this package creates an archive of posts as a home page, but that’s not what we want. It can be removed by running:
npm remove hexo-generator-index
You can now put your index page in /source/index.md
.
Don’t forget to set the layout in the front matter:
---
layout: page
title: homepage
date: 2020-10-17
---