Skip to content
New issue

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

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

Already on GitHub? # to your account

menu items not working when site is a subdirectory #583

Closed
practicalli-johnny opened this issue Apr 14, 2014 · 2 comments
Closed

menu items not working when site is a subdirectory #583

practicalli-johnny opened this issue Apr 14, 2014 · 2 comments

Comments

@practicalli-johnny
Copy link

I have an Hexo website using the default landscape theme. I wanted to have the navbar at the top to have a few additional entries, pointing to pages or external URLs. So I added these entries in the menu: section of the themes _config.yml file, pointing to pages I created with the command hexo new page "clojure" or to external URLs

menu:
  Home:      /
  Archives:  /archives/
  Clojure:   /clojure/
  Ubuntu:    /ubuntu/
  Slides:    http://jr0cket.github.io/
  DevGuides: http://jr0cket.github.io/developer-guides
rss: /atom.xml

When I visit Home or the external URL links, that works okay. When I visit the Archive, Clojure or Ubuntu links in the navbar, they fail because they don't include the subfolder name.

For example, the archive link in the top level navbar has the link

http://localhost:4000/archive

and when deployed on github pages, has the link:

http://jr0cket.github.io/archives/

when it should have the respective links

http://localhost:4000/hexo-themes-test/archive
http://jr0cket.github.io/hexo-themes-test/archives/

In the root _config.yml file, I defined the website URL using github pages, also specifying the child directory:

url: http://jr0cket.github.io/hexo-themes-test
root: /hexo-themes-test/

Unless I have missed something, it seems you either have to hard code the child folder into the menu or this seems like a bug.

Thank you

@practicalli-johnny
Copy link
Author

Yes, I was missing something. In the theme _config.yml definition for menu, apart from home the other entries should not start with a /, so /archive should be archive

So now I have updated my navbar with the following configuration

menu:
  Home:      /
  Archives:  archives/
  Clojure:   clojure/
  Ubuntu:    ubuntu/
  Slides:    http://jr0cket.github.io/
  DevGuides: http://jr0cket.github.io/developer-guides

So now I know how to define the navbar correctly, I'm closing the issue.

Thank you

@Danceiny
Copy link

Oh, I got the same problem with you, and I have tried your methods, the shit slash/////////////
i'm lucky to see this article, i have fix it.Thank you a lot!

zhipengyan pushed a commit to zhipengyan/hexo that referenced this issue Apr 4, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants