Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Here's how I believe I've fixed a problem on my site where my collections list page and my blog list page were using the same meta description as my homepage which was messing up SEO.
The Schema.org markup and Twitter meta tags were also incorrect. The fix I'm now running corrects these three tags which all should have the same descriptive text:
<meta name="description" content="Your text here"> <meta property="og:description" content="Your text here">
<meta name="twitter:description" content="Your text here">
I use Dawn theme and am on v15.0. The changes I made are in the layout/theme.liquid file and the snippets/meta-tags.liquid file.
I make no claims that this will work for anyone else! I've seen many "how do I fix this???" posts - including one of mine. So thought I'd share where I've landed. So far - seems like a better place than where I was.
If this doesn't work for you, you might check the file names of your theme. For example, the name of the template that is used for your collection list might not be "list-collections".
A trick to finding the name of your blog and collections template:
The {{ template }} will print the name of your collection list template to the screen. It might be the same as mine - "list-collections" or not. Whatever prints to the screen - use that where I've used "list-collections".
You can just delete that Custom Liquid section from your template once you've got this info.
You can do the same thing to find your blog template. When you're in the Online Store > Customize area, select "Blogs" and find the template you use for your blog then follow the steps above.
Here's the code I'm using. Again - I'm a shop owner not a coder! Try this at your own peril! Remember to make a back-up of these files just in case you need to revert. Seriously.
layout/theme.liquid
Find this code in your theme file. In my Dawn theme it's not far from the top, around line 25:
{% if page_description %} <meta name="description" content="{{ page_description | escape }}"> {% endif %} {% render 'meta-tags' %}
Just above this code I added the following code that assigns the meta description text I want to show for my collections list page and my blog post list page to the page_description variable:
{% if template == 'list-collections' %} {% assign page_description = 'Your text here' %} {% endif %} {% if template == 'blog.name-of-your-blog-template' %} {% assign page_description = 'Your text here' %} {% endif %} {% if page_description %} <meta name="description" content="{{ page_description | escape }}"> {% endif %} {% render 'meta-tags' %}
snippets/meta-tags.liquid
Next I added this code to the snippets/meta-tags.liquid file.
At the top of my file there was this code:
{%- liquid assign og_title = page_title | default: shop.name assign og_url = canonical_url | default: request.origin assign og_type = 'website' assign og_description = page_description | default: shop.description | default: shop.name if request.page_type == 'product' assign og_type = 'product' elsif request.page_type == 'article' assign og_type = 'article' elsif request.page_type == 'password' assign og_url = request.origin endif %}
Within this code I added the same page_description variable assignment that I included in the theme.liquid file, changing the code to this:
{%- liquid assign og_title = page_title | default: shop.name assign og_url = canonical_url | default: request.origin assign og_type = 'website' if template == 'list-collections' assign page_description = 'Your text here' endif if template == 'blog.name-of-your-blog-template' assign page_description = 'Your text here' endif assign og_description = page_description | default: shop.description | default: shop.name if request.page_type == 'product' assign og_type = 'product' elsif request.page_type == 'article' assign og_type = 'article' elsif request.page_type == 'password' assign og_url = request.origin endif %}
Again - I don't know if this will work for others. If you are using the Dawn theme there's a good chance it will? I'm no coder! I likely can't answer your questions. But like many out there, I'm working hard on optimizing my storefront and my collections and blog are important pieces in the SEO puzzle I'm trying to solve.
That's it. Good luck!
We recently spoke with Zopi developers @Zopi about how dropshipping businesses can enha...
By JasonH Oct 23, 2024A big shout out to all of the merchants who participated in our AMA with 2H Media: Holi...
By Jacqui Oct 21, 2024We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024