Jekyll - Automatically highlight current tab in menu bar

后端 未结 12 988
鱼传尺愫
鱼传尺愫 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:50

    Similar to @ben-foster's solution but without using any jQuery

    I needed something simple, this is what I did.

    In my front matter I added a variable called active

    e.g.

    ---
    layout: generic
    title:  About
    active: about
    ---
    

    I have a navigation include with the following section

        
    

    This works for me as the amount of links in the navigation are very narrow.

提交回复
热议问题