Search code examples
jekyll

Check if current page is homepage on Jekyll


There's any way to check if the current page is the homepage?

I want use h1 tag for the logo image only when the current page is the website base url.


Solution

  • You can use page.url to check if the current page is your index page:

    {% if page.url == "/index.html" %}
       <h1>...</h1>
    {% endif %}