Drupal views archive page

| Drupal Development | 4 seen

<p>Today I decided to give some face-lift to my blog page. I wanted to add an archive function to filter blog posts by month. If you have views enabled, you can use default view archive, which comes with views.</p><p>Since I already had created a page blog, I didn't see any use to use 2 identical views - archive and blog. So I didn't enabled archive view, instead I fine tuned my existing blog page view:</p><p>Add Contextual filter:&nbsp;<strong>Content: Created year + month</strong>, to your blog page.</p><p><img src="http://www.reinisfischer.com/sites/default/files/contextual-filter.JPG&…; alt="" width="1117" height="528"></p><p>Set&nbsp;<strong>Display all results for the specified field</strong>&nbsp;WHEN THE FILTER VALUE IS NOT IN THE URL</p><p>Override title <strong>Blog %1</strong></p><p>&nbsp;</p><p>These settings will allow to pass argument in URL, by not making any harm to your existing blog page.&nbsp;</p><p>Now lets add new block from views. And head to Contextual filetrs section. Change behaviour for&nbsp;Content: Created year + month</p><p><img src="http://www.reinisfischer.com/sites/default/files/changedisplay.JPG&quot; alt="" width="702" height="552"></p><p>&nbsp;</p><p>Save your view. Go to blocks page, and add new block you just created to some of your theme regions (like sidebar).</p><p>And here is the result:</p><p><img src="http://www.reinisfischer.com/sites/default/files/blog.JPG&quot; alt="" width="971" height="238"></p><p>&nbsp;</p><p>If pressed on October:</p><p><img src="http://www.reinisfischer.com/sites/default/files/blog-october.JPG&quot; alt="" width="971" height="230"></p><p>&nbsp;</p><p><a href="http://www.reinisfischer.com/blog">Try a live example here</a></p>

Add new comment