forestryio / jekyll-menus

A menus (site navigation) plugin for your Jekyll website that also works with https://forestry.io (Jekyll CMS)
MIT License
134 stars 27 forks source link

Menus don't display on GitHub Pages #15

Closed MH15 closed 4 years ago

MH15 commented 6 years ago

I have my menus defined in a menus.yml file and I'm using the demo code to display them but the for lop doesn't find any items. What am I doing wrong?

https://github.com/MH15/xc/tree/gh-pages

ecupaio commented 5 years ago

I have the same issue. I don't think github pages supports the menus plugin and they are not clear on what plugins they support.

You can add the menu yml to your _config.yml which renders the plugin useless. I just got the plugin bc Forestry has a UI for it.

envygeeks commented 5 years ago

https://pages.github.com/versions/

envygeeks commented 5 years ago

Indeed ya'll are right, Github Pages doesn't support Jekyll-Menus. You will need to build it on your computer (there is a Docker image available https://github.com/envygeeks/jekyll-docker) and then push to your gh-pages branch.

ecupaio commented 5 years ago

https://pages.github.com/versions/

Yeah, I've seen that link around when people ask about supported plugins, but it's about as useful as a screen door on a submarine.

envygeeks commented 5 years ago

That list is everything that Github pages installs in their Docker image.

ecupaio commented 5 years ago

neat, that doesnt help me know which plugins it supports. I just keep a personal list of plugins that won't work on gh-pages. Adding jekyll-menus to the list.

envygeeks commented 5 years ago

Keep it civil, I am not required to help you. And that is literally a list of what plugins, and themes are supported on Github Pages, and their current versions.

ecupaio commented 5 years ago

I figured out a better way to use your menus on gh-pages, you can keep your menus in the data folder since jekyll has a native functionality for data files. You'll need to remove the plugin for this to work

_data/menus.yml

sidebar: 
  - url: /example
     title: Example

**index.html***

{% for menu-item in site.data.menus.sidebar %}
<ul>
   <li>{{ menu-item.title}}</li>
</ul>
{% endfor %}

Sorry the solution is delete the plugin :/. Inshallah one day github will support it.

wtgee commented 5 years ago

Sorry the solution is delete the plugin

@ecupaio I removed all references to jekyll-menus but am still having the same problem. Is there some trick to make it work?

wtgee commented 5 years ago

Oops, I got it. You said this but I didn't read clearly.

          {% for link in site.menus.header %}

to

          {% for link in site.data.menus.header %}

Note that this breaks any children menus without a little manual work.

ecupaio commented 5 years ago

gotcha. you could do a loop within the loop to get at the child menus, which I'm assuming you did. you can send me a DM if you need any jekyll help

DirtyF commented 3 years ago

GitHub Pages only allow a whitelist of plugins: https://pages.github.com/versions/

It's possible though to get this plugin run on GitHub Pages, by using GitHub Actions: https://jekyllrb.com/docs/continuous-integration/github-actions/