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

current-menu-item style not applied when the url is set to an html file #8

Open
GreatEmerald opened this issue Jul 13, 2016 · 4 comments

Comments

@GreatEmerald
Copy link
Contributor

In my current setup, I have a menu like this:

urls:
    - text: Home
      url: /index.html
      icon: fa-home
      layout: post
    - text: Articles
      url: /category/General articles.html
      icon: fa-file-text
    - text: About
      url: /about/index.html
      icon: fa-user

(This is because the server I'm using at the moment only displays pages that really exist, so just a link to /about/ or / would give a 404.)
This works fine, but the style of the menu button does not get the current-menu-item style applied to it when I visit the menu item.

@codeasashu
Copy link
Owner

Which layout these .html files are using? Do they support/have YAML front matter in them?

@GreatEmerald
Copy link
Contributor Author

They're the same as the incuded sample files. The General Articles one is just an altered jekyll.md.

@codeasashu
Copy link
Owner

Edit _config.yaml and look into urls (menus). It supports layout. Mention the layout your page is using and it will match with it and will highlight whenever the page is loaded.

So for ex- If your general articles.html has the this front matter:

===
layout: article
===

and you have a menu article in config, you can mention layout in the one you want to highlight.
Please see how I am highlighting home menu whenever each blog individual page is visited.
https://github.com/ashutosh2k12/hcz-jekyll-blog/blob/gh-pages/_config.yml#L13

and each post has the layout type post which matches the one with menu
https://github.com/ashutosh2k12/hcz-jekyll-blog/blob/gh-pages/_posts/2016-06-04-example-content.md

If your HTML doesn't have front matter, it won't work. I will fix this in upcoming releases.

@GreatEmerald
Copy link
Contributor Author

Oh, OK. It does work that way, but then you have the problem that being inside a post always highlights "Home". So in my case, if I want to have a link to a listing of a particular category, the menu entry stays highlighted even if I go to a listing of another category. Hm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants