Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set meta tags using php in a Magento module?

Tags:

magento

This doesn't work in my .phtml file.

$head = $this->getLayout()->getBlock('head');
$head->setTitle("title blah");
$head->setDescription("description goes here");
$head->setKeywords("apples bananas coconuts");
like image 771
desbest Avatar asked Jul 17 '12 10:07

desbest


People also ask

How do I add meta tags in Magento?

To access this functionality, go to Stores -> Configuration -> Catalog -> Catalog -> Product Fields Auto-Generation. This is the place where you can set how to form product meta tags.


1 Answers

I believe you are going to want to put that code into your controller, not your view files.

like image 199
Josh Pennington Avatar answered Oct 07 '22 15:10

Josh Pennington