0

I am building a front page that comprises a number of Views-based blocks. How can I create a front page that has no actual "content" (besides these blocks) without getting a "Page not found error"?

The best I have been able to do is create a Views page and set a filter that will never return a result e.g. nid < 0. I set the path to the front page and the title to none. This seems like unnecessary overhead.

Surely, there must be a better way?

4 Answers 4

2

If it was me, I would create a custom page-front.tpl. I'd omit the $content region and probably create a few custom regions for the homepage. I can then place my blocks into the regions.

D6 create page-front.tpl.php
D7 create page--front.tpl.php

Cheers.

1
  • Thanks but I'm not sure that solves the problem. The title tag still shows page not found. I would probably have to use a preprocessor function to get around this. Commented May 14, 2013 at 21:22
1

Consider using Panels and Ctools Page Manager to create a page and populate it with blocks or other content. You can use one of the built-in layouts, create your own, or use one from Panels Extra Layouts

Once you've built your page, you can then assign its path to the site's front page.

1
  • So far, I have been trying to stick to Context but I may have to throw in towel at some point and switch to Panels. Commented May 15, 2013 at 8:10
0

Front Page module is supposed to solve problems like yours:

The Front Page module allows for customised home pages dependant on role. The pages can be of the following types:

  • Alias (only 2.x branch) - Allows for another Drupal path to be shown as the home page without redirecting the user.
  • Redirect - Allows you to redirect users to a local or remote URL.
  • Themed - Allows you to enter some static text that will be placed into the content area of a standard Drupal page.
  • Full - Allows for static content to be displayed to the screen as is. This method does not pass through Drupal's theming system.

Alias should be most interesting for you.

2
  • Not sure this is what I need. It still requires me to alias the front page to another path. Commented May 15, 2013 at 8:20
  • And under that path you can have whatever you want, without dealing with default frontpage code. It allows you a clean start - to build new front page from scratch, using whatever means you want, be it Simple Page node, Views page, page created by your custom module...
    – Mołot
    Commented May 15, 2013 at 8:23
0

Here's what I would do:

  • Create a new content type called "Homepage"
  • Edit the default display of the content type to hide what you want (e.g. Body).
  • Create a Homepage node and point front page to it in admin settings.
  • Add blocks to their respective regions (you could also use a grid system like Zen Grids which comes with Zen, this is what I do1)
  • You can override page--node--homepage.tpl.php to do stuff like removing the title, or any extra control you want over it.

1 A grid system is a really nice way to control the position of elements on your site. Generally I use regions to control the vertical order of elements, and then the grid to position horizontally.

2
  • Thanks. I don't think a front page merits its own content type (at least in my own case as I don't have the need for multiple front pages). I am using Zen (and ZenGrids) but the issue is that of the path. Commented May 15, 2013 at 14:21
  • The Homepage content type isn't so that you can create multiple homepages (after all, you can only point the front page at one), it's about decoupling it from a standard page content type so that you have control over it without ruining your page content type. What's the issue with the path?
    – njp
    Commented May 15, 2013 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.