Jekyll - Automatically highlight current tab in menu bar

后端 未结 12 935
鱼传尺愫
鱼传尺愫 2020-12-22 15:34

I am using github to host a static site and Jekyll to generate it.

I have a menu bar (as

    ) and would like the
  • correspo
12条回答
  •  时光说笑
    2020-12-22 15:56

    Lot of good answers are already there.

    Try this.

    I slightly alter the above answers.

    _data/navigation.yaml

    - name: Home
      url: /
      active: home
    - name: Portfolio
      url: /portfolio/
      active: portfolio
    - name: Blog
      url: /blog/
      active: blog
    

    In a page -> portfolio.html (Same for all pages with a relative active page name)

    ---
    layout: default
    title: Portfolio
    permalink: /portfolio/
    active: portfolio
    ---
    
    

    Portfolio

    Navigation html part

    
    

提交回复
热议问题