How to replace default meta tag from “layout” with customizing meta tags in “view” with HTML?


Meta tags are used to store data about HTML documents such as who wrote it and the description of the document.
The best solution is to define default tags in the application and overwrite default parameters in view. We can do so in PHP.

Making changes in config file first −

<?php
return [  
   ‘addemailid’ =>’ demo@example.com’,  
   ‘descrip’=>’docdescription’
];

Making changes in the layout −

<?php
   $this->registerMetaTag($app->params[‘ademailid’], ‘ademailid’);
   $this->registerMetaTag($app->params[‘descrip’],’ descrip’);
?>

Updated on: 24-Jun-2020

183 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements