Search code examples
jekyll

How to create a simple, hard-coded navigation bar in Jekyll?


I'm generating a Jekyll site with a lot of pages. By default, all these pages are included in the menu.

Screenshot

I don't want the majority of these pages to appear in the navigation bar. I want only two of them to be there: a) /rumerica/ and b) /about/.

I tried to use the approach from this answer and put the following file into _data/menu.yaml file:

- text: Home
  url: /
- text: Rumerica
  url: /rumerica/
- text: About
  url: /about/

But nothing changed. How can I make Jekyll render only two (static and hard-coded) menu items without using any plugins?

Notes: You can find the source code of my site (without the new changes) here.


Solution

  • It seems that this feature has been added in scope of the following issue:

    In order to hard-code the list of pages to display in the navigation bar you need to add the following lines into _config.yml file:

    header_pages:
      - rumerica/index.md
      - about.md