Concept

  1. First we need understand how Hexo’s blog page works.
  • By default, Hexo will create a blog page that will showcase all your posts. Refer to this.
  • Hexo creates a index.html, which is your blog page, when deploy using hexo d or hexo deploy.
  • This is all based on the pre-installed module hexo-generator-index, which you can config under _config.yml file:
1
2
3
4
index_generator:
path: ''
per_page: 10
order_by: -date
  • the value from path adds suffix to your website url.

If you want to display your custom page by default instead of the “blog page”, follow steps below.

  1. Deploy your blog page somewhere else.
  • Go to file _config.yml, find these lines:
    1
    2
    3
    4
    index_generator:
    path: ''
    per_page: 10
    order_by: -date
  • Edit value in path, for example I change to follow:
    1
    2
    3
    4
    index_generator:
    path: 'blog'
    per_page: 10
    order_by: -date
  • After first step, you will get error when trying to accessing your website’s main url, as the index.html is not auto-generated anymore. Therefore you will need to create a index.md file under source folder manually.
  1. Create your own default page.
  • Create a index.md under source folder. Other naming will require additional works. So we are stick to index.md in this case.
    • Type in Hello World! in your index.md.
  • You are all set! Run hexo g && hexo s and you shall see your Hello World! message.
  1. You can edit your index.md to show all your writings, all your posts and pages.
  2. Visit mine for an idea!