This is still an issue, can someone please help me
At this point i use this module from Codealist but it's just for the homepage and the problem is that the CMS pages also get a Prefix and Suffix.. if i can make a small change to this module so the CMS page's also take the default Title.. that would be great, but i don't know how..
Module:
https://www.codealist.com/magento-2-x-set-default-page-title-for-homepage/
Hello Badmintonplanet
Call custom phtml file below title by xml, follow below directory to open xml file and put below code.
Product Page:
app/desigin/frontend/your_theme/module_theme/Magento_Catalog/layout/catalog_product_view.xml <referenceBlock name="page.main.title"> <block class="Magento\Catalog\Block\Product\View\Description" name="subtitle" template="product/view/subtitle.phtml" /> </referenceBlock>
get subtitle attribute in subtitle.phtml.
$product = $block->getProduct(); <h1 class="page-title"> <?php echo $product->getName(); ?> and <?php $block->getCurrentStoreName() ?><h1>
Same for category page, you need to override category xml.
app/desigin/frontend/your_theme/module_theme/Magento_Catalog/layout/catalog_category_view.xml
hope it will help you, if works then mark as solution.
Thanks @prakash786,
I've tried your solution but i don't think it's working as i want (to bad).
Did you understood what i ment by page title?
I ment the title you see when you make for instance a bookmark or the text that's getting echo'ed when you search the page on Google (see image below).
My question is. Is there a way to create a ‘simple’ module that easily echo’s the {{product_name}} and {{store_name}} of the category- and product page.. so i can use hem inside the ‘default site description’. We run version 2.1.9..
So in practice we want to get:
Get your new {{product_name}} from {{store_name}}, always the best prices at {{store_name}}.
But only for the Category page and Product Detail page.
Cause now if you change it with the 'standard' Magento prefix and suffix solution, the problem is also that the CMS and homepage change.