Get meta_description and meta_keyword to the product page

It sounds crazy, but you will find this trick extremely useful when you design a standard AMP product page. Ie the other pages are still responsive normal, only the product page is responsive + AMP (removes the default header). Why are you curious about this because AMP is now trendy, you can see the AMP section in the new WMT menu bar. 

This new get 2 meta, a lot of other new issues can make a full AMP page. I write to store and if you see or can follow the page for more related articles 
Get meta_description and meta_keyword to the product page


Step 1: Write more code in Controller


Open Catalog >> Controller >>  Product >> Open " product.php " 

Insert below: 

$ data ['heading_title'

The following two lines: 

$ data ['meta_description'] = $ product_info ['meta_description']; 
$ data ['meta_keyword'] = $ product_info ['meta_keyword']; 

Go back 

Step 2: Call them in product.twig file 


<meta name = "description" content = "{{meta_description}}" /> 
<meta name = "keywords" content = "{{meta_keyword}}" />

Get meta_description and meta_keyword to the product page

Save and clear the cache. Then try adding meta keyword and meta des to 

0 nhận xét:

Post a Comment