Husky Ninja Blogs

Views Views Views

Drupal 7, as I mentioned earlier, has the default UX of a screaming child, and it takes all kinds of modules or custom coding (or just modules) to make it play nice with users, the internet, and everything. One of those modules is so important to the design and control of the taxonomy and UX that it is to be included in Drupal 8 core, and if you should include it now if you are building a 7 site. The module is Views.

Views can do so much for your Drupal site that it is way more powerful than what I have used it for (so far). At this point, I am just trying to organize my content so it makes some sort of structural sense, fits in with the rough taxonomy I built, and lets the users navigate in a more logical manner. But how did I get here?

When I started building this site, I figured that the Blogs module (included by default) would be sufficient to handle the information I wanted to post. I figured I would post some technical articles, some personal stories, and the occasional news article. I would order these using taxonomies, and that they would have a logical structural order based on those taxonomies. BUZZZ-IT. Wrong. Blogs was restricted to my username, and ordering the content by type wasn't in the game for Blogs. I could use all the different content types and build a navigational structure, but that would still leave me with a URL structure that looked like nothing that the content represented. Using the power of Google, I kept reading "Views Views Views". So I looked at it, installed it, loved it, and bought it a house.

Views itself is fairly well documented, is popular enough to have a lot of resources ready to help you on the inter-webs, and installation is as easy as the rest (copy/pasta to sites/all/modules). You will need Chaos Tools (which I had) installed first. Once Views is enabled, you can create your custom views at Administration >> Structure >> Views. There are all kinds of really cool default views that can be enabled from here, like an Archive, or controlling the front page, or comments. But I just wanted a logical URL structure and related navigation to go along with my taxonomy. So here's what I did.

First, I created a new Content Type, let's call it "News", to relate to the view (Administration >> Structure >> Content Types). I left more or less everything as default (with some minor exceptions that isn't important here).

New Content Type, ready to Save

Once I had my new Content Type, I went over to the Views configuration (Administration >> Structure >> Views). From here I selected "Add new view". Here's where the magic happens.

Creating a new View - make sure to set the Type to your new Content Type

From the "Add new view" screen, I created a "View name" (News - no shock there), and then set "Show" to "Content", "Type" to my Content Type (News), and reset the "Items to display" to 5 (from the default 10). Next, I selected "Create a block" so I would have a navigation block to use later, hit "Save" and I was ready to go!

My new View in the Views view. View!!!1!!

Now I have a page ready to receive my new Content Type.

A new page waiting for me to get off my butt and start typing

You will also notice that the breadcrumb picks up the new context I just created, so that the internal navigation is ready to go with the new view. And that I will cover in my next post.