Add "Node Title to Original URL" for creating views

kyle_mathews - February 2, 2008 - 04:09
Project:FeedAPI
Version:5.x-1.0
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

Here's my problem. I want to aggregate comments from a number of different blogs and place them in a block I create with views. I want the block to use "list view". I want these comments to link directly to the original comment but right now (it seems) I'm unable to do that. I can add a "node title" to my view which points to the comment node created by FeedAPI but there's no way I can see to include a link to the original comment on the original blog post.

I know that using aggregator I can create a block where the items do link directly back to the original article -- but I need articles from a number of different feeds all to mash together in one block.

Setting the view type as "teaser" does work to some extent -- it has the link at the bottom "original article" -- but that's not very intuitive. Most people will just click on the title link and never see the "original article" link.

I'm really liking your work so far. FeedAPI has been a life saver for my website and I see several upcoming sites where it'll be very useful.

#1

Aron Novak - February 4, 2008 - 06:39

I see two possible ways (both of them require a little coding):
- theming the views-created block (you can retrieve the original article url link from feedapi_node.module)
- extend aggregator with one block where all the feeds ' items can be found

#2

kyle_mathews - February 5, 2008 - 00:27

Coding is not a problem, I think I'll theme the views block. It would be nice still to expose to views a node-title with the original url. I think what I'm wanting to do is a fairly common usecase for using an aggregator like feedapi.

Thanks for the suggestions!

#3

jesss - March 28, 2008 - 15:40

How exactly would I retrieve the original article url link from feedapi_node.module?

It looks like the function I would need to use is feedapi_node_link, but I'm not sure of the syntax to properly invoke it. Can you give me an example?

#4

joeboris - March 31, 2008 - 11:45

Subscribing

#5

jlndrr - April 10, 2008 - 10:07

I wanted to do something similar.
It would surely be nice to have a "title with link to original article" filed exposed in Views by feedAPI

In the meantime, this comment gave me the tip on how to do it via theming : http://groups.drupal.org/node/7277#comment-22230

- I duplicated the node.tpl.php from my theme into my sub-theme

- I renamed it node-story.tpl.php as I only wanted this behavior on the Story content type
With this theming tip, you must not mix aggregated content and your site content in the same type -- your own site content would loose the link in the title. A more conditional code could allow the PHP to select the right link.

So, you may have to create another content type, let say "External Comments", and set-up The "Feed" content type to generate this kind of node. Note that you can have multiple master Feed type too (one for fetching comments in an External Comments type, another to fetch blog post...)

- I made the change explained in the comment, I quote : « replacing:

<h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
... with this:

<h2><a href="<?php print $node->links['feedapi_original']['href'] ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
»

- As a bonus, I added a rel="me" in the link tag, because I was pointing to my own post on another site. You may want to do the same if you use feedAPI to build your own "lifestream".

------

#6

momper - April 11, 2008 - 17:21

subscribing

#7

alanburke - July 17, 2008 - 14:26

subscribing...

I reckon there must be a way for a custom module to provide this item as a field to views.

Can't get my head around it though...

 
 

Drupal is a registered trademark of Dries Buytaert.