Skip to content
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

Blog entries in a subfolder, custom home page #1971

Closed
pronvit opened this issue May 22, 2016 · 10 comments
Closed

Blog entries in a subfolder, custom home page #1971

pronvit opened this issue May 22, 2016 · 10 comments
Labels
stale wontfix This will not be worked on

Comments

@pronvit
Copy link

pronvit commented May 22, 2016

Is it possible to have all blog entries in a subfolder, that is, blog to be just a part of a site, and /index.html just a custom page? I can configure permalinks, tags, pages, etc. to be generate in, for example, /blog subfolder. But blog index is still hardcoded to be /index.html, right?

If that's not currently possible, can you point me to where I should start looking to change it in the code?

@pronvit
Copy link
Author

pronvit commented May 23, 2016

It seems the only change I had to make is in hexo-generator-index/lib/generator.js on line 10 from '' to, for example, 'blog'. And then create /index.html just as a normal page. Maybe this can be made a configuration option?

@zyzyz
Copy link

zyzyz commented May 23, 2016

You can just change the "url" and "root" in config to put all your blog into one subfolder.

Or you can create a .md file into your favorite folder with specific layout placed in your theme, but at the cost of losing accessibility of properties related to pagination(for hexo will still treat it as an PAGE).

For full customization, you have to write your own generator(maybe with new local variables calculated by yourself) and register it into hexo.

@pronvit
Copy link
Author

pronvit commented May 23, 2016

@zyzyz If I change root, then entire hexo-generated site will be in that folder, while I want just the blog in a subfolder. Basically, I want to use hexo not just for blogging but for my entire site (to share templates, etc.), and I need home page to be just a normal page, not blog index.

Anyway, my change in hexo-generator-index/lib/generator.js seems to work - pagination and everything work as expected.

@Xuanwo
Copy link
Contributor

Xuanwo commented Jul 3, 2016

@pronvit you can try to change the post permalink

@martindsouza
Copy link

martindsouza commented Dec 24, 2016

For others to be clear on the change @pronvit made. in hexo-generator-index/lib/generator.js change return pagination('', posts, { to return pagination('blog', posts, {

You will then need to run hexo generate then restart the hexo server (if already started)

To get the "blog" showing up in the menu modify the themes/<theme_name>/config.yml Mine looks like:

menu:
  Home: /
  Blog: /blog
  Archives: /archives

Note I don't explicitly have a source/blog page.

@rgfindl
Copy link

rgfindl commented Mar 29, 2017

I've created a PR that adds a config option to the hexo-generator-index package. hexojs/hexo-generator-index#7

@davidmtobias
Copy link

Thanks @rgfindl, that works like a charm. A tiny modification in hexo-generator-index package that increases Hexo functionality a lot.

@NoahDragon
Copy link
Member

@pronvit @davidmtobias npm package has updated accordingly. New version is 0.2.1.

@stale stale bot added the wontfix This will not be worked on label Sep 27, 2017
@stale
Copy link

stale bot commented Sep 27, 2017

This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

1 similar comment
@stale
Copy link

stale bot commented Nov 26, 2017

This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

7 participants