How do I get a block to only show on the Front Page ( I have a page called 'home' that I set as the front page and my block will show when there is index.php?q=home, but it does not show when a person first comes to the site and there are not variabes passed through the url.


Island Usurper’s picture

If you go to ?q=admin/build/block, you can configure your blocks to display on certain pages (it looks you already know this). In that list you can put <front> to signify the front page.

Übercart -- One cart to rule them all.

drulvin’s picture

<front> was the key word I was missing. Thanks!

srlinuxx’s picture

How come <front> doesn't work for me? I'm using clean urls. Could that change things? What can I use then?


--You talk the talk, but do you waddle the waddle?

nirl’s picture

try $is_front in the advanced block visibility seeting. seen it somewhere on the site, but lost the reference try


usaginyunyu’s picture

I was having the same problem ^^

Ron Collins’s picture

in version 4.7, i tried the <front> thing and that did nothing. so after looking around, i resorted to html basics.

i loaded up phpinfo() at the bottom of my page.tpl.php and found a variable that was different on the front page than on any other. for me, it was the $_SERVER['REDIRECT_URL'] variable which has a value of '/' on my front page only. in your case, this will likely equal 'index.php?q=home'.

once you find a variable and value that works for you, you can put code something like this in the block setting for "Show if the following PHP code returns TRUE":

<?php if ($_SERVER['REDIRECT_URL']=='/index.php?q=home') {
    return TRUE;
} ?>

or like this for blocks that appear on every page EXCEPT the front page:

<?php if ($_SERVER['REDIRECT_URL']!='/index.php?q=home') {
    return TRUE;
} ?>

you can see an example at by looking at the "Page 2 Headlines" block which only appears on the front page and the "Front Page Headlines" block which appears on all other pages.

greg.harvey’s picture

if (drupal_is_front_page()) {
  return true;

Much nicer.


doomed’s picture

thank your for this.