forestryio / jekyll-menus

A menus (site navigation) plugin for your Jekyll website that also works with https://forestry.io (Jekyll CMS)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Would love some examples

todrobbins opened this issue · comments

I'm trying to get a simple two-level menu working in my header and having a hard time.

- Home
- Projects
  - Project 1
  - Project 2
- About

My menus.yml:

main:
  - title: Main
  - identifier: main
  - url: /

projects:
  - title: Projects
  - identifier: projects
  - url: /projects/

And my header.html include:

<nav>
  {% for my_page in site.menus.projects %}
    {% if my_page.title %}
      <a class="page-link" href="{{ my_page.url | relative_url }}">{{ my_page.title | escape }}</a>
    {% endif %}
  {% endfor %}
</nav>

I know I'm probably missing something obvious. 😁

Hi @todrobbins,

You can see format examples here: https://github.com/forestryio/jekyll-menus#examples-1
That should be

main:
  - title: Projects
    identifier: projects
    url: /projects

  - title: Home
    identifier: Home
    url: /
projects:
  - title: Project1
    url: /projects/project1
    identifier: project1

Thanks! And what about the corresponding snippet in header.html?

Hey @todrobbins sorry for the late response (actually I'm quite embarrassed at how long it took me to respond) but can elaborate what you would me to explain?

Thanks!