Views comes with a number of default views, that are already installed and available the moment we enable the Views module, but are disabled by default. In this video, I will show you how to enable and modify the Archive view, which is a view that displays a list of months that link to views containing content that was published in each month.

To enable a default view:

  • Go to "Structure => Views" (admin/structure/views)
  • Click "Enable" for Archive
  • Click "Edit" (After clicking "Edit", We'll be taken to the Views configuration page. This might look complicated and a bit overwhelming at first, but don't worry I will walk you through each of these settings in the following videos starting with an overview of the UI in the next video. But first, let's make a couple of modifications to this view.)

Title

The title is displayed at the top of the view, anywhere titles are normally displayed, like a page title. You can change it by clicking on the title.

  • Click "Monthly Archive" link (This is where you can change the title)
  • Title: Monthly archive (Articles) (I'll add a filter next to only show articles. So I'll update the title to reflect that.)
  • (Apply(all displays))

We'll skip the next couple of sections for now and come back to them later. Right now, let's take a look at the filter criteria.

Filter Criteria

The filter criteria let's you limit the displayed results of the view. You can filter the results on every available field from your content type. Currently, we have one filter criteria, "Content: Published (Yes)", which will only display published content. Let's add another filter to only show content of the “Article” content type:

  • Click "Add" for Filter Criteria
  • [x] Content: Type
  • (Apply(all displays))
  • Content types: [x] Article
  • (Apply(all displays))

So, now our view is only going to show articles that are published.

Page Settings

In the Page Settings section, we can set things like the URL path. By default, our is set to "/archive". I'm going to change that to "/article-archive".

  • Click "/archive"
  • Path: article-archive
  • (Apply)

You may have noticed a warning message at the top page that says that all changes are stored temporarily, so always remember to click "Save" to make these changes permanent or you run the risk of losing your changes.

  • (Save)

To view the output, right click "view Page" and open link in a new tab. We have "Monthly archive (Articles)" as the title, but the page is empty because we haven't created any articles yet. I’m going to use the Devel Generate module to quickly generate some articles with dummy content.

  • Go to "Configuration => Development => Generate content" (admin/config/development/generate/content)
  • Content types: Select “Article”
  • How far back in time should the nodes be dated?: 1 year ago
  • (Generate)

Now when we view the article archive, we'll see links in the format of "Month YYYY(#)", where the number represents the number of published articles for that month. Clicking on any of these links will show you teasers of published article.