Want to change Title&Meta Description of a Tag Page

Solved
Iky
Tourist
11 0 3

Hi there!

Wondering how can I customize the title tag and Meta Description for a Tag Page..

Now, that tag page and the collection page share the title tag.
Collection page: https://shopmtn.eu/collections/doughty-engineering
Tag Page: https://shopmtn.eu/collections/doughty-engineering/clamp

But, I want the tag page has a unique title: Doughty Clamps - Best Entertainment Equipment - MTN Shop
Any simple way for doing that! Thanks a million=)

Replies 19 (19)
Integrity-Com
Shopify Partner
19 0 11
Click to expand...
Hi - it can be done - we have the only SEO products filter tech in the world that can do this:

https://integritycommerce.com/shopify-product-filter-app/

Our tech is only available through the the ULTIMATE Retail Growth Program:

https://www.ultimateretailgrowth.com/

Thanks,

Kristin

CEO
Integrity Search & Integrity Commerce® - the ONLY themes in the world fully optimized filter/tag pages. The most technically advanced Shopify themes for SEO.
Kashif91
Tourist
27 0 2

@malalta Thanks for your response. 

 

I have checked the code provided in your response and was wondering if we can have code/syntax working in 'AND' logic in the if else condition. Something like if (current tag =boots & men shoes) then the page should have some static meta description that can be hardcoded in this code, else the default home page meta description. 

Could you please help with it?

Like wise we would also want to define Title tags for these pages. Please help with the needful syntax

Many Thanks!

malalta
Shopify Partner
23 5 8

@Kashif91

Yes, you can use "and" logic in the if/else condition. Shopify's templating language (Liquid) is reasonably expressive. These are referred to as "logical and comparison operators" in the documentation and you can see a full list here: https://shopify.dev/docs/themes/liquid/reference/basics/operators

In your case where you're interested in tags, the "current_tags" object is a list of all the tags associated with the current page (docs for "current_tags"), so you're interested in the "contains" logical operator.

Putting it together, your "if (current tag =boots & men shoes)" clause will probably look something like this:

 

{% if current_tags contains "boots" and  current_tags contains "men shoes" %}

 

...assuming "men shoes" is a tag. Looking at the URLs you supplied in your previous post, it looks "men shoes" is actually a collection in which case you can pretty much do the same thing except compare to something on the collection object (probably collection.handle):

 

{% if current_tags contains "boots" and collection.handle == "men-shoes" %}

 

The approach is exactly the same for the <title> tags, or any other content you're interested in: (i) use logical operators to work out what page your on and then (ii) output the desired <title> text (and probably fall back to a sensible default in the "else" block if none of your logic applies).

You can make this a simple or as complicated as you like. Since title / meta descriptions based on tags specifically isn't something Shopify natively supports, there's going to be a bit of up front work implementing it. But if the benefits outweigh the costs for you, go for it!

Jbman
New Member
2 0 0

How is it not native feature of shopify, how these 'shopify gurus' constantly go around telling everybody that nothing can be done, off course it can be done with some basic custom code.

Kashif91
Tourist
27 0 2

@malalta How can we change the H1 tags for these pages? Could you please guide with the relevant code?

malalta
Shopify Partner
23 5 8

@Kashif91 You just need to find the .liquid file that has the <h1> you're interested in, and then the technique will be pretty much the same.

Collection .liquid files can be in a couple of places depending on your theme. Try looking in this order:

  1. template/collection.liquid - Older themes use this file.
    1. If it's nearly empty and contains something like "{% section 'collection-template' %}" look in the "section" folder (step 2)
    2. If it contains something like "{% include 'collection-template' %}" or "{% render 'collection-template' %}" look in the "snippets" folder (step 3)
  2. section/collection-template.liquid - Look for "collection", but it might be named something a little different...
  3. snippets/collection-template.liquid - Again, look for "collection", but it might be named something a little different...

The file you're after will have a lot of code in it. The one I'm currently working on is 140 lines long. Here's the first 20 lines:

{% comment %}
  Collection template, used on collection.liquid and collection.image.liquid
{% endcomment %}

{% paginate collection.products by 18 %}

<header class="section-header text-center">
  <h1>{{ collection.title }}</h1>
  <hr class="hr--small">
  {% if collection.description != blank %}
    <div class="grid">
      <div class="grid__item">
        <div class="rte">
          {{ collection.description }}
        </div>
        <hr class="hr--small">
      </div>
    </div>
  {% endif %}

  <!-- Etc... -->

 

Look for the <h1> tag, which will probably be near the top. Then simply use the techniques I mentioned in the previous comments to work out what page you're on, and output the desired text in the <h1>.

Hope that helps!

Kashif91
Tourist
27 0 2

@malalta thanks for the help. It worked like a charm!!

I noticed that my product page titles and meta have started showing up Unicode. I am not able to get to rid of it. Could you please guide.

Thanks

malalta
Shopify Partner
23 5 8

@Kashif91 No worries, glad it's working out for you

Regarding character encoding in the titles and meta tags – can you create a new question for this? This is moving away from the original topic here, and giving it its own question will make it much easier for other people with the same issue to find answers too. 

Feel free to tag me on the question – I'll get notified and will answer you over there. Also, could you include in your question the bit of the template code you're now using that is generating these titles and meta tags?

Cheers.

khamir
Excursionist
11 0 2

Just went through the entire thread and learnt that some basic code changes to the title and meta descriptions of tag pages within a collection can be done. However, since i'm not a programmer and am not comfortable interfering with the code i'm hoping Shopify builds this capability natively like it exists for the collection/non-tag pages that we create. Hope this message can be considered as a feature request.

Specifically, here is what i'm trying to do...

khamir_0-1634548382116.png

Above is a 'Layered & Frosted Cakes' collection page i created and was able to customize the title and meta description through the admin panel. But within this collection, if i filter it down to the 'Layered & Frosted Cakes/Vegan' options like the screenshot below...

khamir_1-1634548602230.png

...then i don't see an option to add a title & meta description. And when i did a site scan using MS Bing webmaster tools i got this error message...

khamir_2-1634549017426.png

 

..which suggests i've got 183 of them to fix, most of which will be similar in nature.

Hope i've accurately captured and categorized the issue.

Thanks in advance to anyone who can help.

theSEOFairy
New Member
1 0 0

So there is some wild misinformation here.

1. You can create unique meta titles and description for tagged collections.

1.b You can also set them to be non indexable and canonical to the root of that collection. You can code for both.

2. Integrity - nice name but lacking some. I assure you - you aren't the only people with a theme that can do that. I have worked with many that have this coded in now and have it myself on my own main business's e-commerce site. 

Lots of waffle out there answering your question and most of it bar a couple is wrong. My advice would be if it's just Meta title and description then you can do that with the SEO Manager app, or add it in via metafields.

OR you can use the handle identifiers in the edit language page to change the meta title for these variations. The last is quite basic an approach, SEO manager will do it for you easily but you are now going to have to be subscribed to them forever, or do it via metafields and you have a 'never pay again' solution.