Views #1 : Add A New View (Drupal 8 Tutorial #3) (Article + Video)

Submitted by TheMain on Wed, 11/18/2015 - 19:22

In this series we will create a custom frontpage that introduces all the main concepts of the Views module. We will cover topics such filters, sorting, displays, exposed filters, contextual filters and relationships.

Note: the video usually has more explanations and examples.

Create Dummy Content With Devel Module

Let’s first create some dummy content.

  • Go to Devel Module Page.
  • Right-click the Drupal 8 version download link and select Copy Link Location.
  • Go to Extend and click + Install new module.
  • Paste the link in the Install from a URL input.
  • Click Enable newly added modules and enable the Devel and Devel generate module.
  • Go to Configuration > Development and generate some users, terms and content (articles) (in this order) with default settings.

Now you see article teasers listed in the frontpage:

Frontpage teasers

Add New View And Set Default Homepage

  • Go to Structure > Views and click +Add new view.
  • Write the View name : Home.
  • Select the type as Article:

New view

  • Check Create a page checkbox:

Create a page

  • Hit Save and edit.
  • Click View Page button in the View configuration page and you can see the view working in the /home url:

Article teasers

  • Go to Configuration > System > Site information and change the Default front page URL to /home:

Default homepage

  • Click Save configuration.

The view so far:

View so far


Custom Home view as the default Homepage:

Custom homepage

Posted by Samuli Natri on 18 November 2015