Last modified: January 16, 2025 at 4:10pm

Views is a powerful tool for building dynamic content displays. Considering content modeling from a views perspective early in the process can help you ensure you can build the views you need for your dynamic content displays. In this tutorial, we’ll explore how you can think through your content model with Views in mind.

By the end of this tutorial, you should be able to ensure your content model has the necessary structure you’ll need as you build dynamic content displays and pages with Views.

Plan how content will be reused

Views can pull and display content from multiple content types and fields and display them in an array of formats and styles. As you design your content model to be modular and reusable, consider the different ways information will need to be reused, or if you will need separate fields for specific uses.

For example, let’s consider a wine tours site.

  • A layout section on the home page with a block listing “Featured Tours”
  • A page listing all tours, filterable by region or category.
  • A region-specific landing page showcasing tours within a particular area.

But what about the details of these displays? Will 1 media image field suffice, to be resized with responsive image styles? Or is more editorial control required for high-impact displays like a featured tour on the home page? You may want a one media image field for the hero image with precise dimension requirements, and another one which can be used for search result thumbnails or other listing displays. Yet another field may be desired for social media cards.

Consider both the displays, the information to be contained within, and the design requirements as you consider how content will be reused when you build views.

Structure data for flexibility

You can build flexible content displays by leveraging filter and sort criteria in Views. Think about how your content fields will be used as filter and sort criteria.

For example:

  • If you want visitors to be able to sort tours by price, you should store the price as a numeric field rather than plain text.
  • To create a feature where site visitors can filter tours by region, regions should be a taxonomy term rather than a text field.

Category-type fields are great candidates for filter criteria. To use them, you’ll want to create taxonomy vocabularies populated with terms, and then add reference fields to the relevant content type.

For example, create a Wine regions taxonomy vocabulary and add terms for each region. Then add a Wine regions field on the Wine tours content type as a reference to the Wine regions taxonomy. Then you will be able to build a content display using Views that a user can filter by wine region.

Use relationships between content

Relationships allow Views to connect different content types, such as linking testimonials to wine tours or showing wineries associated with a region.

For example:

  • A "Winery Directory" page can use a view that pulls from the winery content type and filters by a wine region taxonomy term.
  • Testimonials can include a reference to the related wine tour, enabling a view that displays testimonials specific to a given tour.

Define content display needs early

Identify what types of views you might need and what information they’ll display:

  • Lists (e.g., all tours in a region).
  • Grids (e.g., a gallery of featured tours).
  • Blocks (e.g., related content or recently added tours).

Ensure your content model includes the fields necessary to populate these displays.

Example: Views-driven scenarios

Scenario 1: Wine tours listing page

  • Content model decisions:
    • Content type: Wine tour
    • Fields: Title, Featured image, Price, Duration, Region (taxonomy term), Tour category (taxonomy term)
  • View configuration:
    • Filters: Published status, Region (exposed), Category (exposed).
    • Display: Grid of tours, sorted by title or price.

Scenario 2: Region landing page

  • Content model decisions:
    • Taxonomy: Wine region
    • Related Content: Wineries (content type) and Wine tours (content type).
  • View configuration:
    • Contextual filter: Wine region term.
    • Displays:
      • Section 1: Wineries in the region (list of Winery content type).
      • Section 2: Tours in the region (grid of Wine Tour content type).
  • Content Model Decisions:
    • Field: "Featured" checkbox field in Wine tour content type.
  • View Configuration:
    • Filter: "Featured" field is checked.
    • Display: List of tours with title and image, displayed in a homepage block.

Wrap-up

Understanding how your content will need to be sorted, filtered, and listed should inform the overall content model. This helps ensure that data is entered consistently, and that the necessary individual data points required for different displays and lists can be queried.

Additional resources

Back to top