meta title, description and h1 tag for page 2

meta title, description and h1 tag for page 2

ihs1
Explorer
103 1 10

hi

after spending hours trying to work this out and still nothing that works, please can you advise how i can change the meta title, description and h1 tag for my blog page 2. see url below and code that ive been told to add to the theme liquid file, but it doesnt work. 

 

i have 23 blog posts, 12 on the first page and 11 on the 2nd page. i need to change the meta details and h1 on the page 2

 

https://infraredheatingsupplies.com/blogs/blog?page=2

 

{% if template == 'blog' %}
{% if paginate.current_page == 2 %}
<!-- Custom Meta Tags for Blog Page 2 -->
<title>Custom Meta Title for Page 2</title>
<meta name="description" content="Custom Meta Description for Page 2">
{% else %}
<!-- Default Meta Tags for Blog Pages -->
<title>{{ blog.title }}</title>
<meta name="description" content="{{ blog.description }}">
{% endif %}
{% else %}
<!-- Default Meta Tags for Other Pages -->
<title>{{ page_title }}</title>
<meta name="description" content="{{ page_description | escape }}">
{% endif %}

Replies 10 (10)

BSSCommerce-B2B
Shopify Partner
1213 317 372

@ihs1 , try this

{% if template contains 'blogs' or template contains 'blog' %}
{% if paginate.current_page == 2 %}
<!-- Custom Meta Tags for Blog Page 2 -->
<title>Custom Meta Title for Page 2</title>
<meta name="description" content="Custom Meta Description for Page 2">
{% else %}
<!-- Default Meta Tags for Blog Pages -->
<title>{{ blog.title }}</title>
<meta name="description" content="{{ blog.description }}">
{% endif %}
{% else %}
<!-- Default Meta Tags for Other Pages -->
<title>{{ page_title }}</title>
<meta name="description" content="{{ page_description | escape }}">
{% endif %}

If our suggestions are useful, please let us know by giving it a like, marking it as a solution.


BSS: B2B Wholesale Solution |BSS: B2B Portal, Quote, Net 30 | B: B2B Lock Password Protect


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency
ihs1
Explorer
103 1 10

hi

i tried this but unfortunately it still does not work. 

 

maybe i am not putting in the correct place or file? im putting in my theme.liquid file

BSSCommerce-B2B
Shopify Partner
1213 317 372

@ihs1 , There are some parts of your code that need editing. It seems the blog variable doesn't exist, and we don't need to use it.

Let try this

{% if template contains 'blogs' or template contains 'blog' %}
   {% if current_page == 2 %}
      <title>Custom Meta Title for Page 2</title>
      <meta name="description" content="Custom Meta Description for Page 2">
   {% else %}
     <title>{{ page_title }}</title>
     <meta name="description" content="{{ page_description | escape }}">
   {% endif %}
{% endif %}

If our suggestions are useful, please let us know by giving it a like, marking it as a solution.


BSS: B2B Wholesale Solution |BSS: B2B Portal, Quote, Net 30 | B: B2B Lock Password Protect


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency
ihs1
Explorer
103 1 10

hi

 

thank you for looking into this, but unfortunately that did not work either

BSSCommerce-B2B
Shopify Partner
1213 317 372

@ihs1 , did you remove the default title tag like this

BSSCommerceB2B_0-1725333508982.png

I don't have blog page but it worked on my collection page 

If our suggestions are useful, please let us know by giving it a like, marking it as a solution.


BSS: B2B Wholesale Solution |BSS: B2B Portal, Quote, Net 30 | B: B2B Lock Password Protect


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency
ihs1
Explorer
103 1 10

hi

i didnt remove anything, im not sure which bit to remove. see the bit of code that is currently there: 

 

<title>
{%- if template == 'list-collections' and collection.handle == blank -%}
Categories - View our range of Infrared heaters
{%- else -%}
{{- page_title -}}

{%- if current_tags -%}
{% capture cat_array %}{%- render 'advanced-tag-loop' -%}{% endcapture %}
{% assign cat_array = cat_array | split: '|' %}
{% assign title_tags = '' %}
{% assign meta_tags = current_tags | join: ', ' %}
{%- for tag in current_tags -%}
{% assign is_advanced_tag = false %}
{% assign cat = tag | split: '_' | first %}

{%- unless cat == tag -%}
{%- if cat_array contains cat -%}
{% assign is_advanced_tag = true %}
{% assign title_tags = title_tags | append: ', ' | append: tag | replace_first: '_', ': ' %}
{%- endif -%}
{%- endunless -%}

{%- unless is_advanced_tag -%}
{% assign title_tags = title_tags | append: ', ' | append: tag %}
{%- endunless -%}
{%- endfor -%}
{{ 'general.title.tags' | t: tags: title_tags | remove_first: ', ' }}
{%- endif -%}

{%- if current_page != 1 -%}
{{- 'general.title.page' | t: page: current_page -}}
{%- endif -%}
{%- endif -%}

</title>

{% if template == 'list-collections' and collection.handle == blank %}
<meta name="description" content="View our range of far infrared heaters perfect for both home and commercial spaces. Discover energy-efficient, eco friendly and fast heating solutions.">
{% elsif page_description != blank %}
<meta name="description" content="{{ page_description | escape }}">
{% endif %}

{% render 'favicon' %}

{% if template contains 'collection' and current_tags %}
<meta name="robots" content="noindex">
<link rel="canonical" href="{{ shop.url }}{{ collection.url }}">
{% else %}
<link rel="canonical" href="{{ canonical_url }}">
{% endif %}

<meta name="viewport" content="width=device-width">

{% assign x_handle = settings.social_x | split: 'x.com/' | last | split: 'twitter.com/' | last %}
{% render 'social-meta-tags', twitter_handle: x_handle %}

<link rel="preload" href="{{ settings.type_menu | font_url }}" as="font" crossorigin="anonymous">
<link rel="preload" as="style" href="{{ 'theme.css' | asset_url }}">

{{ content_for_header }}

{{ 'theme.css' | asset_url | stylesheet_tag }}
{{ 'custom.css' | asset_url | stylesheet_tag }}
{{ 'custom_2.css' | asset_url | stylesheet_tag }}

{% unless settings.reduce_animations %}
{{ 'ripple.css' | asset_url | stylesheet_tag }}
{% endunless %}

BSSCommerce-B2B
Shopify Partner
1213 317 372

@ihs1, try changing the code from start to before {% render 'favicon' %}

BSSCommerceB2B_0-1725334855996.png

By this 

<title>
{%- if template == 'list-collections' and collection.handle == blank -%}
Categories - View our range of Infrared heaters
{%- elsif template contains 'blogs' or template contains 'blog' and current_page == 2 -%}
Custom Meta Title for Page 2
{%- else -%}
{{- page_title -}}

{%- if current_tags -%}
{% capture cat_array %}{%- render 'advanced-tag-loop' -%}{% endcapture %}
{% assign cat_array = cat_array | split: '|' %}
{% assign title_tags = '' %}
{% assign meta_tags = current_tags | join: ', ' %}
{%- for tag in current_tags -%}
{% assign is_advanced_tag = false %}
{% assign cat = tag | split: '_' | first %}

{%- unless cat == tag -%}
{%- if cat_array contains cat -%}
{% assign is_advanced_tag = true %}
{% assign title_tags = title_tags | append: ', ' | append: tag | replace_first: '_', ': ' %}
{%- endif -%}
{%- endunless -%}

{%- unless is_advanced_tag -%}
{% assign title_tags = title_tags | append: ', ' | append: tag %}
{%- endunless -%}
{%- endfor -%}
{{ 'general.title.tags' | t: tags: title_tags | remove_first: ', ' }}
{%- endif -%}

{%- if current_page != 1 and not (template contains 'blogs' or template contains 'blog') -%}
{{- 'general.title.page' | t: page: current_page -}}
{%- endif -%}
{%- endif -%}

</title>

{%- if template == 'list-collections' and collection.handle == blank -%}
<meta name="description" content="View our range of far infrared heaters perfect for both home and commercial spaces. Discover energy-efficient, eco-friendly and fast heating solutions.">
{%- elsif template contains 'blogs' or template contains 'blog' -%}
{% if current_page == 2 %}
<meta name="description" content="Custom Meta Description for Page 2">
{% else %}
<meta name="description" content="{{ page_description | escape }}">
{% endif %}
{%- elsif page_description != blank -%}
<meta name="description" content="{{ page_description | escape }}">
{%- endif -%}

If our suggestions are useful, please let us know by giving it a like, marking it as a solution.


BSS: B2B Wholesale Solution |BSS: B2B Portal, Quote, Net 30 | B: B2B Lock Password Protect


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency
ihs1
Explorer
103 1 10

HI

 

thank you so much for your time in looking into this, but it still isnt working. am i doing something wrong?

is this the correct place to put the code?

ihs1
Explorer
103 1 10

HI

is it possible you can have a look at this again as i still dont have a solution

ihs1
Explorer
103 1 10

HI

hope all is well

sorry to bother you again but i was wondering if you got a chance to have a look at this again to see how we can get this to work please