Rss on your_library_site

Preview:

Citation preview

RSS on your website

Using Drupal Views and

Aggregator/Feeds (or Yahoo Pipes)

Why RSS? – Start the Brainstorm

• Community News Portal – Consolidate school or local media feeds

• Reframe content from your catalog – RSS provided by your OPAC

• Present your own twitter or Facebook posts, without a widget, or as a mashup

• Create a ready-to-blog feed list• Legacy site import

Drupal & RSS• Drupal is fine at producing RSS • Not as good at data mining from

RSS import

• Two basic import options: –Use Feeds module to create nodes

(content)– Import via Aggregator (sources)

In both cases: organize using Views

Both are CRON intensive, and imports need to expire

Feeds Process• Select a content type to populate

from our feed• Create one if necessary using CCK• Create a feed importer using

the feed importer UI and our RSS source• Map the feed onto the content type• Import• Style and display

Create a new content type with CCK• Adds function to the default content types

management pagehttp://www.example.com/admin/content/types

• Edit: Name and describe your new content type• Manage: Use Link submodule to add link

content field• Can use one universal link field but will need to

create unique label for each content type and use display fields to render label as link

• Don’t forget to set user permissions for each new content type

CCK adds the “Add Content Type” function to the Content Types Page http://www.example.com/admin/content/types

Inside the Calendar Item content type – Link Submodule provides “link” option in field types

Unique label can be reset in manage fields

Down the page in global settings we turn off the title

Finally, use display fields to hide the label as a plain text field and instead use the label as the link

Feeds – Create Nodes from Stuff

• Module creates “Feed importers” UI http://www.example.com/admin/build/feeds

• Clone (or override) an importer and edit• Choose attach to nothing (attach to node alters

the content type itself) and time to refresh• Using default templates, shouldn’t have to

change fetcher, parser or processor• Use Node Processor to select content type,

input format and settings to expire nodes• Use Mapping to assign fields to the chosen

content type

Inside a feed importer: You will need to adjust Basic Settings, Node Processor and Mapping. Note the link for Import Page, we’ll get back to that.

Basic Settings lets you set name and description and refresh time – don’t choose content type here, choose standalone form (and import from the import page -- http://www.example.com/import)

Node Processor Settings is where you pick the content type to map the feed to, also set node expiration and the option to update or replace nodes – updates maintain comments, but are more server intensive. Import format lets you choose full html, which will show images in feeds if they exist.

Finally, use Mapping to specify what you want to go where, including that Link submodule back to the source.

The Import page for feeds. Click on a feed to import and then you finally get to add the URL.

And here is a view of the finished calendar content type on the left, next to a differently styled view of an aggregator feed on the right

Aggregator – Ockham’s Razor• Why use many tools when one will do?• Part of Drupal 6 core• Simple to use• Creates Feed Aggregator UI • http://www.example.com/admin/content/aggregator/

• Feeds are “sources,” not content, doesn’t allow comments

• Style and filter through Views into blocks or pages

• In settings, include <img> in allowed tags to have images included with feeds

Aggregator: add feed, add category (here: news) and merge feeds by tagging them with the same category.

Simple and all-in-one :Create a new feed with title, URL, update and category

Unstyled Aggregator block

The “b” is available to any user with blog permission. It opens their blog and inserts a copy of the node and a link to the feed.

Views – Essential Drupal Module• Can format data how you like to see it• All views can be multi-use: block, page,

even multi-page• Can use keyword filtering• Can use with aggregator feeds – choose

aggregator when selecting information style at creation

• Or node content (including imported via feeds module) – choose nodes at creation

• *//Whichever you choose cannot be undone//*

The main Views screen http://www.example.com/admin/build/views

Inside an advanced View: multiple pages and blocks, each using different keyword filters. In this view: exposed filters, selected fields, page path, menu, and a header.

What that view looks like on a finished, themed page

A Word on Keyword Filtering• Yahoo Pipes is very useful for catching errors

of input – can have redundant filters• Drupal logic is more exact

– Can filter node title AND node body, but cannot filter node title OR node body

– Each filter builds on previous (exclusionary)– Can assign taxonomy but cannot mine from content

– couple of modules may exist ‘somewhere out there,’ or maybe you can write custom php code

• Can Use Yahoo Pipes with Drupal, but third party reliance

Exposed Filtering in Drupal

• By exposing a filter, you can let your users search

• Can set up more than one exposed filter: search by keyword and location

• Very useful with content created and associated with taxonomies, users – can filter by categories and give restricted options

• Not as useful if information is not associated

Views – Style Matters• Unformatted gives unstyled list• HTML List – good for sidebars• Table gives attractive zebra striping (if

your theme allows)• Grid gives raw blocks• Use fields to cherry pick elements you

want: title, teaser, other data, leave out elements you don’t want (author, created date)

A final word about CRON• RSS processes are server intensive and

require consistent updates• If you don’t have the ability to set

CRON on your server, add the Poormanscron module

• Try to set your updates for meaningful but not server-taxing cycles.

• If you don’t need your news to update more than once a day – don’t.

Yahoo Pipes

• Extremely powerful – can mashup images, locations and create maps, use complex logic, more than just a text filter

• Easy to use – visual, interactive, drag and drop• Once set up can easily be cloned and keywords

just replaced• Very user friendly for keyword logic – allows

multiple filters on multiple parts of same content: title and body

• Downside is the pipes breaking and reliance on a third party

Embedding Pipes in HTML• Pipes is a feature of any Yahoo account• Build your pipe and save it – don’t need to

publish to use• Choose “Get this as a Badge” and “Embed”• Copy & Paste the code in your HTML page• Script will inherit most CSS of the page• Set up extra CSS to create zebra striping,

blend frame background (badge customizing)

An embedded Pipes Badge at http://www.myjcpl.org

Links

Working with PipesYahoo Pipes: http://pipes.yahoo.comPipes Help Forum: http://discuss.pipes.yahoo.com Customizing Badges:

http://pipes.yahoo.com/pipes/badgedocsMy Pipes: http://pipes.yahoo.com/mwidner

Working with DrupalDrupal.org: http://www.drupal.org Lullabot: http://www.lullabot.com Learn By the Drop: http://learnbythedrop.com My Drupal Site: http://www.peacekaat.com

(link to JCPL Test Site)

Modules we usedFeeds: http://drupal.org/project/feeds CCK: http://drupal.org/project/cck Link (CCK): http://drupal.org/project/link Views: http://drupal.org/project/views Aggregator (core):

http://drupal.org/documentation/modules/aggregator

Dependent Modules Ctools: http://drupal.org/project/ctools Job Scheduler: http://drupal.org/project/job_scheduler

ExtraPoormanscron: http://drupal.org/project/poormanscron

Recommended