Skip to main content

Checking if the current page is the homepage in Drupal 8 - not using drupal_is_front_page

10th May 2016

Mike Dixon

Senior Mind

We will keep this one short and sweet. There is quite a bit of documentation pointing to the fact that drupal_is_front_page() still exists in Drupal 8 ... it doesn't!

Panic not. The solution is nice and easy, the following snippet will act as a drop in replacement for drupal_is_front_page() - simply returning TRUE or FALSE.