0

I want to change category page after filter opens any page and change Title, MetaTitle, MetaDescription in after search result.

What can I do ..and any observer this possible ?enter image description here

0

add this observer code in controller_action_postdispatch

<?php

namespace ABC\Seo\Observer;

class FileName implements ObserverInterface
{
    protected $context;
    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,

    ) {
        $this->context = $context;
    }  
    public function execute(\Magento\Framework\Event\Observer $observer)
    {

        //your code 
        $layout = $this->context->getLayout();
        $pageMainTitle = $layout->getBlock('page.main.title');
        $pageMainTitle->setPageTitle($categoryname); 

    }

Your Answer

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