How To Create A View In Drupal 8 - Manoj Patial

How To Create A View In Drupal 8

Which is better-WordPress vs Drupal?
April 12, 2018

If you are familiar with the process of create a view in Drupal 7 then it will be easy to understand the process of create a view in Drupal 8. The main difference is that Views module incorporated in the Drupal’s core. It will also install with Drupal 8 core installation and no need to install separate module.

So let’s start and know how to create a view in Drupal 8. In this article I am going create view for content type “Article”

Article content type is a default content type created during Drupal 8 installation. You can check out all content type by going to the following path “admin/structure/types”.

By going to the following path: “admin/structure/types/manage/article/fields” we can find out the fields associated with content type Article.

We can add content to content type “Article” by going to the path “node/add/article”. The page will look like as shown below:

After adding the content, our view will be listed in the node teaser. It looks like this:

For getting the above view, we need to follow the following steps:

  1. Go to Manage > Structure (admin/structure)

2. Click on Views link to create a new view. You will redirect to Views configuration page (admin/structure/views)

There are many default views on the View list page. According to your requirement, you can either duplicate or edit and use these predefined views. Or you can create an entirely new one by clicking the “Add new view” button.

3. The below  image shows you how to duplicate or edit an existing view. The Duplicate feature in Drupal 8 is the same as in Drupal 7.

4. Here we’ll create a new View  for listing the article content type. For create a new View click on  “Add new view” button.

You will get a form similar to the one below screenshot. Enter view name in the field “View name”. In this example, I am giving the view’s name as Article View. For the fields “Show” and “of type:”, I have selected Content and Article respectively.

Click button “Save and edit”.

5. It will redirect you to the “Article View” page. By default, it comes as master display based on our settings.

Change the “Show” setting to “Content”.  You can do this by clicking “Show: Fields” under “FORMAT”. You will get a popup box like the one below:

Here in popup select “Content” and click “Apply” to change the setting. Next you will get next step in popup asking you to specify “View mode”. Select “Teaser” from the dropdown and click “Apply”.

Now I am going to add a page display for our view. Click the “+ADD” button placed after “Master” on the left. Select “Page” from the drop-down.

Then Page display will added in View after click on Page link.

Now next step is to set the Path for the page display. You can set the path for View under PAGE SETTINGS and click on “Path: No path is set”. A popup will appear, allowing you to define the path to display the view.

Add the path “article-view” for our views page display. Then click “Apply”.

You will be directed back to the views page. Click “Save”.

Finally, after you have saved the view, navigate to the path you specified: “article-view”. You will see that article list from our view page display. It will look like this:

0 0 votes
Article Rating
Manoj Patial
Manoj Patial
I am Manoj Patial, a website developer from India, I have more than 10 years of experience in website development. I developed more than 200+ website using Drupal, WordPress, PHP, Codeigniter, shopify, HubSpot and other CMS/PHP frameworks.
Notify of
Inline Feedbacks
View all comments

Pin It on Pinterest

Would love your thoughts, please comment.x