0

I need to add the suffix to the catalog page title programmatically for SEO.

Currently in view source code i am getting catalog category page title like

<h1 class="page-title" id="page-title-heading" aria-labelledby="page-title-heading toolbar-amount">
    <span class="base" data-ui-id="page-title-wrapper" >Mobile</span>    
</h1>

Mobile - is the currently catalog category page title. But i need to add suffix to the tile for catalog category pages.

For example:

<h1 class="page-title" id="page-title-heading" aria-labelledby="page-title-heading toolbar-amount">
    <span class="base" data-ui-id="page-title-wrapper" >Mobile Online </span>  
</h1>  

<h1 class="page-title" id="page-title-heading" aria-labelledby="page-title-heading toolbar-amount">
    <span class="base" data-ui-id="page-title-wrapper" >Computer Online </span>    
</h1>

So i need to add suffix Online for all category pages. How can i achieve this?

  • suffix will be same for all categories ? – Pawan Oct 17 at 18:19
  • @Pawan yes, the suffix will be same for all categories. – Arul Oct 18 at 5:07
0

You will need to pull down magento2/app/code/Magento/Theme/view/adminhtml/templates/title.phtml and set a different title template via catalog category view assuming you want to do this for only the catalog template... if you want to do it for everything (pages, products, modules etc) just pull down the file to your theme and do whatever changes you'd like.

-1

Use jQuery function append():

For example:-

$("span.base").append(" Online");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.