Objective: Create a Blogroll (list of links and descriptions). We want a block to show a set number of the links, in a random order. We also want a page to show all of the links and descriptions.
Difficulty: Easy. Don't go by the length of this article. :)
Step 1: Create a content type called "blogroll_item".
Navigate to /admin/content/types/add/. I used the following settings:
Name: Blogroll Item
Title field: Title
Body field: blank (this makes the content type have no Body field)
Default Options: Published (none of the others -- you don't want these showing up on the front page, most likely)
Save the content type, then click its "Edit" link. Choose "Add Field" from the top. Here are the parameters:
Type: Link (save)
Link Title: Required
NoFollow Value: Yes
Save this, and add another field for the description. Here are its parameters:
Type: Text field (save)
Rows: 2 (it is up to you)
Multiple Values: No
Text Processing: Filtered HTML
Save this, and click Manage Fields. Give the URL field a weight of -1, because you want it to be above the Description. Save.
Click Display Fields. Make sure the Teaser setting for URL is "Default as link." Save this.
Call the Body field "Description" or "Notes" or something that indicates that it will be information about the link.
Step 2: Create the Page view
Navigate to /admin/build/views/add. Here are the parameters:
Provide Page View: yes
View Type: Table View (or List View, you can try both and see which you like better)
Nodes Per Page: 10 (you decide)
- Name: Link (URL)
- Handler: Group Multiple Values
- Option: Default As Link
- Name: Text: Description
- Handler: Group Multiple Values
- Option: Default
- Sortable: no
- Name: Node: Edit Link
- Name: Node: Delete Link
- Field Node Value is one of blogroll_item
- Node Published is True
Sort: Node Title (ascending)
Save this and test it by creating a few Blogroll Item nodes, and going to http://www.example.com/blogroll/. You should have clickable links for the URLs, and descriptions if you added them. They should be in alphabetical order by the Node Title. I made the Node Title and Link Title the same thing for all of mine, as it seemed to make the most sense.
Step 3: Create the Block view
You need a separate view for the block, because you probably don't want the descriptions to show up in the block. You probably also don't want to list every link in your blogroll, but an arbitrary number, probably sorted in a random order.
So create a new View, called "blogroll_block." Here are the parameters:
Provide Block: Yes
View Type: List View
Nodes Per Block: 10 (you decide)
(More) Link: No
<a href="http://www.example.com/blogroll/">(More)</a> (a fake More link which goes to the Page view you created in step 2)
Fields: Link: URL, Option Default as Link
Filters: Same as the page view
Step 5: Enable the block.
In /admin/build/block you now have a block called "blogroll_block". Enable it and put it wherever you want it on your page.
Step 6: Make it quicker to add Blogroll Items by using the Node Go To module.
This module lets you specify a page to go to after inserting, updating, or deleting specific node types. Go to the Administer By Module page, and find the Node Go To section. Under Insert, find Blogroll Item, and paste the link to /node/add/blogroll-item/.
Now after you create a blogroll item, you will be presented a blank form to create another (and another and another).
Step 6: Go crazy adding links to your blogroll!