How To Create Views in Drupal 8

Introduction

Drupal is among the top Content Management Systems (CMSs) across the globe, alongside Joomla and WordPress. The process of creating views in Drupal version 8 is similar to the one for Drupal 7. The only difference is that Drupal 8 has incorporated the Views module. It is automatically installed once you install Drupal 8 core.

Views feature allows the user to display pieces of content on their website in any format. The pieces of content include comments, nodes (articles, basic pages, or blog posts), taxonomy terms (tags or labels), and user profiles.

This tutorial will take you through the steps involved in creating views in Drupal 8.

Let’s start.

Step 1: Finding Views

  1. To get started with views, check the Article content type by navigating to the admin dashboard, then go to the Structures section and click Content Types. Or follow the path - “admin/structures/types.”How To Create Views in Drupal 8
  2. The next thing is to locate the fields connected to the Article content type. To do so, follow the path (admin/structure/types/manage/article/fields) or go to the admin dashboard again, locate Structures, click the Content Types icon. Then go to the Manage Fields and press Articles, before clicking the Fields section.How To Create Views in Drupal 8
  3. To add your content, follow the path - “node/add/article” or go to the admin section, click the +Add Content button, then the Article link.How To Create Views in Drupal 8
  4. Once you’ve added your content, the view page will be present in the node teaser, and it should look like this:

How To Create Views in Drupal 8

Step 2: Creating a View

  1. To start, navigate to the Manage page and press the Structure tab (admin/structure).How To Create Views in Drupal 8
  2. To create an entirely new view, select the Views link on this page. You will be taken to Views Configuration page. You can also follow the path: admin/structure/views.How To Create Views in Drupal 8On this window, you will notice a slight difference in style layout from the previous Drupal version 7 Views configuration page. By default, there is a wide list of views. Based on your needs, you can choose to edit or duplicate and use these views. You can also create a new view by pressing the Add view button.
  3. The illustration below shows how to edit or duplicate a current view. Drupal 8 Duplicate feature is similar to Drupal 7 Clone feature.How To Create Views in Drupal 8
  4. Before we start creating a new view, let’s look at some details about Views and Advanced View settings.Navigate to the Basic section if you want to configure the basic settings (path: admin/structure/views/settings). In this case, you can choose what to display and set it at default, or view the SQL queries in the current view.How To Create Views in Drupal 8You can access the cache settings by clicking the Advanced section. This is one of the new features in Drupal 8.

    How To Create Views in Drupal 8

  5. Let’s create a new view to list the content type in the view. Use the path - “admin/structure/views/add” or go to the admin section, look for the Structure section, then go to the Views section, and click on the Add view button.

    You will be presented with a page prompting you to fill in the View name field. For this example, we will use the Article list as our view name. Also, enter the details for the s Show and Of type. We have selected Content and Article respectively for these two fields.

    Then click the Save and edit button.

    How To Create Views in Drupal 8

  6. You will be taken to the Article list page.How To Create Views in Drupal 8Here, you need to edit and change the setting Show to Content. To do so, press Show: Fields icon under FORMAT. A popup box will appear as shown below:

    How To Create Views in Drupal 8

    On this page, choose Content, then click Apply. Another popup will appear prompting you to clarify the View mode you prefer. From the drop-down menu, select Teaser and then click the Apply button.

    How To Create Views in Drupal 8

  7.  This will take you to the Master display page. For the current view, add an extra page for the display then press the +Add section just after the Master icon. Now, choose Page from the drop-down.How To Create Views in Drupal 8Your page display will be added to your current view automatically.

    If you look closely at the Page button, you will notice it has a red-colored border. This indicates that there are authentication errors.

    How To Create Views in Drupal 8

    At this point, set a Path for your page display. Set it under the PAGE SETTINGS. Go to the Path: No Path is set section. You will see a popup that will allow you to indicate the path to present your current view.

    How To Create Views in Drupal 8

    On the popup, enter the path article/list, then press the Apply button.

  8.  You will be taken to the views page.Press the Save button to apply these changes.

    Once you have saved your view, go to the article/list. Here, you will see your article list displayed on your view page. You should see the following:

How To Create Views in Drupal 8

Conclusion

That’s it! You can now go ahead and create entirely new views in Drupal 8. If you run into problems while creating a view in Drupal, don’t hesitate to contact us for further assistance.

Check out the top 3 Drupal hosting services:

Was this article helpful?