Hi Guys,
Is there a way to update Page Title through Edit Code option?
I want to add word " - Wholesale" in all my product Page Titles. I have already added the same in my products Title: https://creedvintage.com/products/g73a-leather-jackets
Please guide.
Hi @hellomenew
On the product page backend, at the bottom. you will find “Search engine listing” section, you can update your page title from there.
and to update it via code for all products, in theme.liquid, you will find {{ page_title }} replace it with
{% if template contains "product" %}
{{ page_title | append: " - Wholesale"}}
{% else %}
{{ page_title }}
{% endif %}
Please check if it works for you
Thanks & Regards
Pawan
1 Like
Hello @hellomenew
Please follow the steps below:
Step 1: Open the code editor and search for main-product.liquid section file
Step 2: Find {%- when ‘title’ -%} case and under that you can find {{ product.title | escape }}
Step 3: Write your custom text next to {{ product.title | escape }}. Just like {{ product.title | escape }} {{ ’ - Wholesale '}}
Step 4: Hit the save button and check for the result on the product page.
Reference video: https://www.awesomescreenshot.com/video/27223190?key=2d2f9f0308f0cad9cdde42ea3de4e674
Please hit Like and Mark it as a Solution if you find our reply helpful.
1 Like
Hi Pawan,
This one works well.
But when I add this code homepage and other collection pages titles repeat itself.
For example, the collection page was Pawan Kumar is the best
It shows like this Pawan Kumar is the best - Pawan Kumar is the best
For products title shows 1 time with Wholesale which is good.
Could you please help me with that.
Hi Pawan - anything for me please?
Hi @hellomenew
You have to replace the {{page_title}} with above code, since we are just using the page_title conditionally, so it should appear only once and for products it should suffix with " - Wholesale"
Please check if you are doing it correctly
Thanks!
1 Like
Hi Pawan,
I exactly copied the same code and replaced {{page_title}}.
It is working perfectly for the products page.
However, the problem is, collections and homepage titles are showing twice. In the admin panel it is just showing once, but in the source code it shows twice.
Collection Page Title Pawan Kumar is the best - Pawan Kumar is the best
Admin Panel shows Pawan Kumar is the best
Also, I wanted to add, before editing the code Homepage and Collection pages Titles are just showing once.
Once I use your given code, product pages works perfectly but other pages on the website duplicate the titles and show it twice. Which is strange.
It worked. I was doing the same thing. It didn’t work before.