[Debut] If statement in header for logo

Solved

Hi,

What's the purpose of this code in header.liquid

What's the outcome in the two different situations and when are they used?

Thanks

<div>
        {% if request.page_type == 'index' %}
          <h1 class="h2 site-header__logo">
        {% else %}
          <div class="h2 site-header__logo">
        {% endif %}

SOME CODES HERE

        {% if request.page_type == 'index' %}
          </h1>
        {% else %}
          </div>
        {% endif %}
      </div>

 

-Like and Mark as an Accepted Solution if my reply is helpful
I'm not an expert, these are my own experiences or codes that I gathered from others. I'm using Debut.
I have my own online pet supply store check it out at
PETLANTIS.CA
0 Likes
Winbox
Excursionist
26 6 5

This is an accepted solution.

From what I can tell, it's mostly for page outlining purposes. If you are on the frontpage (index), it will use the logo or shop name as H1 (Heading 1, the top of the page outline). Otherwise, the logo or shop name becomes decorative and instead perhaps uses the title based on the context of the page as H1. For example, a product page would use the product name as the H1, a blog article page would use the article title as the H1, etc. The way pages are outlined may vary from theme to theme.

0 Likes

@Winbox 

thanks for the reply.

Now the problem is when I'm editing the codes, sometimes it assigns the wrong closed </div> to the divs.

On that note, there is one more <div> in between where I put SOME CODES HERE.

So I was wondering if this is an error from the theme writers or just how it's supposed to be. And if it's going to affect the page load speed

-Like and Mark as an Accepted Solution if my reply is helpful
I'm not an expert, these are my own experiences or codes that I gathered from others. I'm using Debut.
I have my own online pet supply store check it out at
PETLANTIS.CA
0 Likes
Winbox
Excursionist
26 6 5

The structure in the code snippet you provided appears to be just fine. Not much else I can say except for just double check the nesting in the SOME CODES HERE part. If you like, feel free to share more of the code if possible and then we can take a closer look.

0 Likes