Views and Offsets: Grouping multiple displays into one view

I like to group similar views into a single view that has multiple displays. I find it’s easier to keep track of everything this way. For example: the blog page on Design to Theme has a full node page display, an RSS feed, and a block with recent blog entries generated from a single view.

Three displays are better than two views

The features of this View include:

  • Full text for the most recent blog post.
  • The ten most recent blog posts not including the current post displayed as a list.
  • RSS feed displayed on-page.

To create these three displays I created a single view showing all published nodes of the content type “Blog” with a sort criteria of Date created, Descending. Then I created three displays with the following variations:

Page display
  • Fields: Title, Post date, Body, Add comment link.
  • Items to display: 1
  • Use pager: no
  • Style: Unformatted
Block display
  • Fields: Title, Post date (formatted as “time ago”)
  • Items to display: 10, offset 1 (omits the most recent blog post)
  • Style: Table (with no headings)
Feed Display
  • Row style: node (shows all fields)
  • Items to display: 10 with 0 offset
  • Attach to: Page display

Tip To change the characteristics of each display you must click on the “Override” button for each property that you want to alter. The view editing screen will distinguish between the Defaults and the Display-specific settings with an italicized font. Items that are displayed in italics use the Default settings; items that are not italicized are custom for the selected display.

With the view created I then placed the Block display in the footer of the page and set the visibility settings so that the block only displays when the path matches blog/*.

Want More Tutorials?

Are you interested in getting even more tutorials sent to your inbox? Sign up for our incredibly popular tips mailing list and get a free tutorial every month. You may even win a coupon for a free e-book (include your whole name if you want to win stuff).

For a limited time we'll even send you a bonus tips sheet The Top Ten Mistakes People Make when Theming Drupal when you sign up for the list.