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>
Solved! Go to the solution
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.
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
User | Count |
---|---|
23 | |
21 | |
18 | |
17 | |
16 |