New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make a custom homepage in hexo 3 #1077

Closed
DanielBaird opened this Issue Mar 2, 2015 · 15 comments

Comments

@DanielBaird

DanielBaird commented Mar 2, 2015

According to #1062 the config option for exclude_generator was removed from hexo 3.0. I'm using hexo 3 partly because I need the page.more feature, and figured why not try out the latest RC.

So: what's the correct way in hexo 3 to make a custom (root)/index.html file? Do I have to put all my homepage content into the theme's index.ejs or something?

@tommy351

This comment has been minimized.

Show comment
Hide comment
@tommy351

tommy351 Mar 2, 2015

Member

Add index.md to source folder. You can see hexojs/site for example.

Member

tommy351 commented Mar 2, 2015

Add index.md to source folder. You can see hexojs/site for example.

@tommy351 tommy351 added the question label Mar 2, 2015

@pierrickrouxel

This comment has been minimized.

Show comment
Hide comment
@pierrickrouxel

pierrickrouxel Mar 9, 2015

It doesn't work for me. The index.md is totally ignored.

pierrickrouxel commented Mar 9, 2015

It doesn't work for me. The index.md is totally ignored.

@ike

This comment has been minimized.

Show comment
Hide comment
@ike

ike Mar 9, 2015

@pierrickrouxel make sure you don't have the hexo-generator-index module installed.

ike commented Mar 9, 2015

@pierrickrouxel make sure you don't have the hexo-generator-index module installed.

@wanghaisheng

This comment has been minimized.

Show comment
Hide comment
@wanghaisheng

wanghaisheng Mar 31, 2015

if I have a index.html and dont want to use theme to generate this index from md ,how could I realize this using hexo 3

wanghaisheng commented Mar 31, 2015

if I have a index.html and dont want to use theme to generate this index from md ,how could I realize this using hexo 3

@iqiancheng

This comment has been minimized.

Show comment
Hide comment
@iqiancheng

iqiancheng Apr 8, 2015

npm install hexo-generator-index --save

iqiancheng commented Apr 8, 2015

npm install hexo-generator-index --save

@shadowysean

This comment has been minimized.

Show comment
Hide comment
@shadowysean

shadowysean Sep 23, 2015

@ike Removing that package works! Thx~
As I see, the exclude_generator option brings some convenience, why was it deprecated in 3.0+? @tommy351

shadowysean commented Sep 23, 2015

@ike Removing that package works! Thx~
As I see, the exclude_generator option brings some convenience, why was it deprecated in 3.0+? @tommy351

@ChongTang

This comment has been minimized.

Show comment
Hide comment
@ChongTang

ChongTang Oct 21, 2015

@shadowysean How do you make the custom home page works? I removed the hexo-generator-index dependency from package.json, and added an index.md file in source folder. But I got some errors when I run "hexo generate" command. Those errors are from theme's .ejs file. Looks like the theme doesn't support custom homepage. Which theme are you using? Thanks!

ChongTang commented Oct 21, 2015

@shadowysean How do you make the custom home page works? I removed the hexo-generator-index dependency from package.json, and added an index.md file in source folder. But I got some errors when I run "hexo generate" command. Those errors are from theme's .ejs file. Looks like the theme doesn't support custom homepage. Which theme are you using? Thanks!

@jakedappcast

This comment has been minimized.

Show comment
Hide comment
@jakedappcast

jakedappcast Dec 8, 2015

@ike I was working on this problem for 5 hours and I got it to work by taking your advice! Thanks!

jakedappcast commented Dec 8, 2015

@ike I was working on this problem for 5 hours and I got it to work by taking your advice! Thanks!

@Xuanwo Xuanwo closed this Dec 8, 2015

@luofanghao

This comment has been minimized.

Show comment
Hide comment
@luofanghao

luofanghao May 15, 2017

The solution in this issue seems already out-of-date? Is there any way that still working?

luofanghao commented May 15, 2017

The solution in this issue seems already out-of-date? Is there any way that still working?

@lekhnath

This comment has been minimized.

Show comment
Hide comment
@lekhnath

lekhnath May 23, 2017

@luofanghao I am using Hexo Theme Icarus and the solution is working for me.

lekhnath commented May 23, 2017

@luofanghao I am using Hexo Theme Icarus and the solution is working for me.

@luofanghao

This comment has been minimized.

Show comment
Hide comment
@luofanghao

luofanghao May 23, 2017

@lekhnath thanks for your reply, I just looked through the theme. But what this post (and my) need is to create a customised index.html, through this index.html can be linked with a blog, or some other stuff. like this one

luofanghao commented May 23, 2017

@lekhnath thanks for your reply, I just looked through the theme. But what this post (and my) need is to create a customised index.html, through this index.html can be linked with a blog, or some other stuff. like this one

@NoahDragon

This comment has been minimized.

Show comment
Hide comment
@NoahDragon

NoahDragon May 23, 2017

Member

@luofanghao your scenario is not same as this question.

You could modify the index layout in the theme folder to meet your requirment.

Member

NoahDragon commented May 23, 2017

@luofanghao your scenario is not same as this question.

You could modify the index layout in the theme folder to meet your requirment.

@paul-hammant

This comment has been minimized.

Show comment
Hide comment
@paul-hammant

paul-hammant Jul 15, 2017

Yup, as @ike said npm remove hexo-generator-index worked.

paul-hammant commented Jul 15, 2017

Yup, as @ike said npm remove hexo-generator-index worked.

@MoezGholami

This comment has been minimized.

Show comment
Hide comment
@MoezGholami

MoezGholami Mar 13, 2018

Hi
I still have the hexo-generator-index, I changed its path to /blog in my _config.yml. In order to have my custom homepage (based on what @sergiolepore said in #713), I added the following lines on top of my index.html (yes, html not md) (don't worry, they'll be removed):

layout: false
---

MoezGholami commented Mar 13, 2018

Hi
I still have the hexo-generator-index, I changed its path to /blog in my _config.yml. In order to have my custom homepage (based on what @sergiolepore said in #713), I added the following lines on top of my index.html (yes, html not md) (don't worry, they'll be removed):

layout: false
---
@nouyang

This comment has been minimized.

Show comment
Hide comment
@nouyang

nouyang Apr 14, 2018

Confirming that simply creating an index.md file in the my-site/source folder allows me to change the homepage.

I still wished to have a page which listed my most recent blog posts. So in my my-site/_config.yml I put

index_generator:
  #path: ''  # DELETE
  path: '/blog'

After creating the file (and running hexo g hexo s), when I access localhost:4000, I get my custom homepage. And then when I access localhost:4000/my-site/blog, I get the "original" homepage listing my blog posts.

I did not need to npm uninstall hexo-generator-index. I also did not need to create an html file, and did not need to do what @MoezGholami says above.

hexo: 3.7.1
hexo-cli: 1.1.0

nouyang commented Apr 14, 2018

Confirming that simply creating an index.md file in the my-site/source folder allows me to change the homepage.

I still wished to have a page which listed my most recent blog posts. So in my my-site/_config.yml I put

index_generator:
  #path: ''  # DELETE
  path: '/blog'

After creating the file (and running hexo g hexo s), when I access localhost:4000, I get my custom homepage. And then when I access localhost:4000/my-site/blog, I get the "original" homepage listing my blog posts.

I did not need to npm uninstall hexo-generator-index. I also did not need to create an html file, and did not need to do what @MoezGholami says above.

hexo: 3.7.1
hexo-cli: 1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment