Add metatags on custom frontpage in Drupal 7

Frontpages are often very customized. In many cases they have a separate template file with a combination of normal Blocks and View Blocks. 

On a recent project I couldn't print out the metatag information on the frontpage, although I installed the Metatag module correctly and I did put it in the correct place at admin/config/search/metatags > Global: Front page. 

I read through the comments on and lots of comments pointed me to the sollution. You need to render the content on the page. This information is needed to print the metatags in the <head>. 

So, I did put the region in my layout and right at the top of my front-layout.tpl.php file: 

<?php render($page['content']['metatags']); ?>

This method will render the content without printing it. 



Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.