Cakephp - Add meta tags to views

less than 1 minute read

This is how you add well formated meta tags to a cakephp views even thou the meta tags are rendered in the layout.

In the head section of your layout, add this line: <?php echo $scripts_for_layout ?>

And in the view template you can call the meta HTML helper function to dynamticly add tags and descriptions to pages. $html->meta('keywords', 'keywords for the page goes here one two three', array('type' => 'keywords'), false); $html->meta('description', 'The description of the page goes here, cakephp is cool', array('type' => 'description'), false);

Source: http://book.cakephp.org/view/206/Inserting-Well-Formatted-elements

Categories:

Published:

Leave a comment