Get a collection seo_title tag

Highlighted
New Member
3 0 0

Hi there!

Is there any way to get exactly the seo_title not the default collection title from outside of the collection page?

Let me explain a little bit more.

We're trying to improve SEO for our site. And we have many tagged pages. Let's say there is a Collection #1 and a Collection #2 which is subcollection by tag. When you're on a collection #1 page an url looks like www.site.com/collections/collection. This page has a title "Great collection | Shop". And there are a sidebar on the page with a list of tags. So after you clicked on "Subcollection" tag you're going to a page www.site.com/collections/collection/subcollection where you can see products with specified tags. And the title of this page looks like "Great collection | Shop - 'tagged: tagname' "

So the question is how to get seo_title from the Collection #2 when you're here: www.site.com/collections/collection/subcollection

It is obvious how to get the seo_title when you're directly on a parent page of the collection on www.site.com/collections/subcollection. But how to get it when you're outside of this page?

Thanks in advance for any help!

0 Likes
Highlighted
Shopify Expert
9925 103 1763

The "tagged with" will be something that your theme is adding to the <title> tag. Generally this sits in theme.liquid but can differ depending on the theme in use.

Do you have a store link to share along with the name of the theme in use? That will help the forum members give some more focussed responses.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Highlighted
New Member
3 0 0

Hey, Jason! Thanks for the quick response.

Yea the "tagged with" sits in theme.liquid inside the <head> tag. However we're trying to avoid such kind of titles for tagged pages. We're trying to set titles for tagged pages the same as they are for collection page.

Sure I can provide links.

Our site is https://epica.com

This is a collection page: https://epica.com/collections/journals As you can see the title of this page is fine. It is taken exactly from "SEO title" field from the seo box at the bottom of collection admin page.

Also you can see some filters in the left sidebar. Lets click on "Unique Leather Cover Journals". So now you're on the tagged page which has an url: https://epica.com/collections/journals/unique-leather-cover-journals And the title is not fine there and looks like: Personalized Leather Journals & Notebooks | Epica – Tagged "unique-leather-cover-journals"

However this subcollection is actually a separated collection with a ruleset to show products by tags. An url of this collection is: https://epica.com/collections/unique-leather-cover-journals And the title is fine again here and taken from SEO title field.

So the idea is to set exactly the "unique-leather-cover-journals" collection title into the tagged page after you clicked on "Unique Leather Cover Journals" on the "Journals" page. Unfortunately we still can not find the way to get the SEO title from a collection page and set it to another page. And its really weird because we can easily get a main title of any collection from any other place for example with this way:

{% for collection in collections %}

  {% if collection.title == "Unique Leather Cover Journals" %}

    <p>{% collection.title %}</p>

  {% endif %}

{% endfor %}

But there are no something like {% collection.seo_title %} which would be the best solution and could resolve a problem with tagged pages for everyone. During my searching I met few threads where people trying to improve their SEO for tagged pages and the only suggestions they had is to set "noindex, follow" for this kind of pages.

Is there any way to get SEO title with the same way as {% collection.title %} variable can be get?

0 Likes
Highlighted
Shopify Expert
9925 103 1763

But there are no something like {% collection.seo_title %} which would be the best solution

There is - it's just not as clear. The seo title and description is saved as a metafield. To grab the value from a specific collection:

{{ collections.some-handle.metafields.global.title_tag }}

Or:

{% assign someValue = 'some-handle' %}
{{ collections[someValue].metafields.global.title_tag }}

The important thing to remember is that the value might not always exist. It will only exist if it was customised in the first place - otherwise it will revert by default to the title and partial text from the actual product description.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Highlighted
New Member
3 0 0

Jason, that is amazing! Thanks a lot for your help, you just made our day :)

0 Likes