Search code examples
jekyllmarkup

Create Tabs or Hide/Unhide Content in Jekyll?


Essentially what the question says - is there some way to achieve the equivalent of Angular's ng-if or just the html's visibility: hidden; and toggle it in Jekyll?


Solution

  • Please understand what Jekyll is: It is a static site generator that outputs static HTML on change (not on request, like PHP does). There is no such thing as hiding or unhiding things in Jekyll. All tabs should exists in the the HTML/DOM that Jekyll generates. Some of them can initially be hidden, but that is as far as Jekyll goes.

    The actual switching between the visible elements should be done by javascript, as javascript can change the HTML/DOM after the request.

    So, to answer your question: You can create/generate different tabs in Jekyll, but you should toggle them using javascript.

    Does that answer your question?