OK, I installed Feeds and enabled the default Feeds configuration. It works like a charm: created a feed node with the rss url in it, and it created feed item nodes. Easy.

But when you look at a feed item node, can't realize that is aggregated. There is no link to the original source, the author is anonymous, the date and time is the same for every node...

So it needs some configuration. But where and how to do it?

(I tought It should be don at mapping, but the only thing i can do there is removing fields, or add the defaults again.)

CommentFileSizeAuthor
#36 617486-36_feed_item_view.patch11.2 KBalex_b
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

alex_b’s picture

Title: How to link to original source » Create link to original source, view of items on feed nodes
Version: 6.x-1.0-alpha5 » 6.x-1.x-dev
Category: bug » feature

You couldn't find it because it's not there : )

This is a feature request. I think this functionality should go into feeds_defaults.

thamas’s picture

So 'till it will be resolved (and 'till there will be an upgrade method), I should use the FeedAPI! Thanks for the clarification!

jscm’s picture

This feature is really important... I think.
Where and When are you thinking to introduce this feature?

I need this feature strongly!

askibinski’s picture

subscribing

fumbling’s picture

Subscribing

WoozyDuck’s picture

Subscribing

escoles’s picture

would love to see this.

Robert Castelo’s picture

Would rate this as a 'Should Have' feature.

mcaudy’s picture

Subscribing

jarea’s picture

Subscribing

FeedAPI does this out of the box and it is challenging to go hunt down a feed's nodes.

Hara Kim’s picture

does the links to the source only not work in drupal 6 or all versions?

strr’s picture

Subscribing:
...I think we "Feeds" need this very soon in order to replace feedAPI project.

smartinm’s picture

The links to the source (and other fields as Owner feed nid and Import date) are already available using FeedsNodeProcessor and Views (tested on feed-6.x-1.x-dev)

Related:
#584034: Views integration
#664644: Store feed link and expose via Views

strr’s picture

Is this included in the current download or do i need to patch the feeds.views.inc from http://drupal.org/node/584034
I tried to import this view: http://pastebin.com/m6b7004a6 that gave me couple of errors:

* Field handler feeds_node_item.imported is not available.
* Field handler feeds_node_item.guid is not available.
* Field handler feeds_node_item.url is not available.
* Field handler feeds_node_item.feed_nid is not available.
* Field handler feeds_node_item.imported is not available.
* Field handler feeds_node_item.guid is not available.
* Field handler feeds_node_item.url is not available.
* Field handler feeds_node_item.feed_nid is not available.
* Unable to import view.

Thank you.

surgeonbor’s picture

subscribing.

smartinm’s picture

@strr Views integration is included in the current development version (feed-6.x-1.x-dev).

For example, create a "Feed item" content type (Administer › Content management > Content types) and select it in "Settings for Node processor" (Administer › Site building › Feed importers > Edit). Use this view: http://drupal.pastebin.com/m13e5c4b9

ju’s picture

As for the original question about the link to the original source at a feed item node,
its rather easy can be done in a theme:

just add to your feed item node template (something like node-feed_item.tpl.php):

<div>
  	<?php print l('Source', $node->feeds_node_item->url); ?>
  </div>

JakePehrson’s picture

Subscribing:
This is a must addition. Not only is it good karma to link back to your syndicated content it is often illegal to user syndicated content without linking back to or citing the source correctly. I await patiently. Thanks for your hard work.

green monkey’s picture

Subscribing - would really like to have this feature. I had to go to FeedsAPI to get correct layout.

Current Feed working with

Title = Title and link to remote doc - but lose link because I map it as a Title
Arrow image with link to remote doc - unable to map
Desc = Body no prob

inside the Desc there is a link to remote doc user link -- of the user that made the post - this is grabbed as the URL, which yes it is a URL but goes to a profile page and not the doc

FeedsAPI seems to be grabbing the Arrow link or the URL from the Title which is correct.

PS: this new Feeds module is very cool and very intutive to use. It has a mature feel to it and its only in Alpha :)

arnaudfischer’s picture

subscribing

arnaudfischer’s picture

Hello Ju, thank you for the guidance; fully appreciated. I could not find the node-feed_item.tpl.php you mentioned. If you get a chance to locate it. Thank you.

-arnaud

bizkut’s picture

You need to create it

publicmind’s picture

subscribe..

alexfisher’s picture

Subscribing

michellezeedru’s picture

Subscribing

pcambra’s picture

With views its quite easy to show the feed children of a feed parent but I can't see the way of displaying the feed parent in one of the child, is this possible?

slicedsoup’s picture

This is almost a perfect module for my purposes,
but the big problem is the URL, the node created gets the URL field mapped to itself instead of the link to the original remote source item
This defeats the purpose.
Surely there is a quick change to fix this?

vlooivlerke’s picture

#17 works

<div>
  <?php print l('Source', $node->feeds_node_item->url); ?>
  </div>

But how do i get it to print the URL instead of the word "Source" ?

thanks

edit:

<a href="<?php print $node->feeds_node_item->url?>"><?php print $node->feeds_node_item->url?></a>

is there a better way?

amosquito’s picture

subscribe

slicedsoup’s picture

#28 above provides a working answer with:
<a href="<?php print $node->feeds_node_item->url?>"><?php print $node->feeds_node_item->url?></a>

But I need to get the URL into a url cck field from $node->feeds_node_item->url
and it would be great if this module could do this, it makes perfect sense that it should be able to do it.
In the mean time is there anyway I could achieve this with the template.php or else a small custom module?

srobert72’s picture

Subscribing

kompressaur’s picture

subscribing

InterceptPoint’s picture

I too am having a problem with Feeds that is similar to that described in Post #19:

In Views it is easy to use the "Feeds Item: Item link" field to properly map to the URL of the RSS article source. The links work and everything is fine. But you have this ugly URL displayed when in Table layout.

So how to fix this? Well Feeds has a solution: Check the "Rewrite the output of this field" checkbox and enter the appropriate replacement token. The title of the article is available and should work just fine - one would think. So you check off the "Display as link" checkbox and surely it will now display the title of the article with the link functioning.

BUT THAT DOESN'T WORK. THE TITLE OF THE ARTICLE DISPLAYS BUT IT IS NOT A LINK.
That's a bug not a feature and it needs to be fixed. For my purpose Feeds is useless until this issue is resolved.

mgifford’s picture

With views I want to be able to isolate the link directly to the item in the feed. I don't want to have to link to a page and then force my user to click to another link to get the data. I just want the only link to go right from the view to the external item's URL.

Seems like this is still needed.

marafa’s picture

subscribing and adding

+1

alex_b’s picture

Status: Active » Needs review
FileSize
11.2 KB

This is a view that is enabled when using the default configuration "Feed":

http://skitch.com/alexbarth/dcbcr/development-seed-technological-solutio...

http://skitch.com/alexbarth/dcbcm/all-items-from-development-seed-techno...

It shows all important functionality for creating links to original articles and links back to the parent feed node. I plan to commit this soon.

Working on this I realized that there is a conceptual problem with feeds_defaults: enabling depending node types and views is tied to enabling specific importer configurations. This is awkward. What we should do is provide a couple of Features instead: #851194: Featurize.

Sam Straub’s picture

alex_b: Just wanted to express my gratitude to you. The patch worked great and helped me with something important I was working on.

illmatix’s picture

Subscribing!

alex_b’s picture

Status: Needs review » Fixed

#36 is now committed as part of #851194: Featurize

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

MAds’s picture

This is a brilliant patch.

Ive produced the page perfectly, but when I tried to put it on my front page as a block, it only produces 'There are no items for this feed at the moment.'

Is it possible with this view to also have a block? (I have added block into the view, but that didn't do anything)

Thanks in advance

edt:
ok, nevermind...I took out the argument and it works fine now

AntiNSA’s picture

CAn you please tell me how to get the original link in the teaser? I would appreciate it.

strr’s picture

Has anyone a Idea how to get the source link worl for drupal 7 -feeds?
In drupal 6 - feeds this was working in node.tpl.php:

print $node->feeds_node_item->url" rel="nofollow"> print $node->feeds_node_item->url

But not anymore ? Any suggestions ?

Thank you.

JustMagicMaria’s picture

I put this in my node--feed-item.tpl.php for Drupal 7:

  <div class="field field-label-inline">
    <div class="field-label">Source:&nbsp;</div>
    <?php
      $feed = node_load('node', $node->feed_nid);
      print l($feed->title, 'node/' . $node->feed_nid);
    ?>
  </div>

But this is a horrible hack. Not just that this should be done in a preprocess function; this should be a selectable as a source in "Mapping for node processor" (shouldn't it?).

mefisto75’s picture

sub

johninnit’s picture

subscribing

NicoB’s picture

Version: 6.x-1.x-dev » 7.x-2.0-alpha4

subscribing

phillyray’s picture

I had to figure this out for a project I was working on. I created a file "node--feed-item.tpl.php". Since I am extending the Bartik template with my own, I copied the templates/node.tpl.php file to create that file under my own template. Below are the lines I added to provide the link to the article from the feed:

<?php if ($page): ?>
    <?php
      $result = feeds_item_info_load('node', $node->nid);
    ?>
    <a href="<?php print $result->url; ?>" target="_blank">Read Full Article</a>
  <?php endif; ?>

The full file is here:
https://gist.github.com/2024451

phillyray’s picture

Even a more elegant solution is to add this to your template.php file:

function [template_name]_preprocess_node(&$variables) {
  if($variables['type'] == 'feed_item') {
    $feed_item = feeds_item_info_load('node', $variables['node']->nid);
    $variables['feed_item_url'] = $feed_item->url;
  }
}

And add this to your node--feed-item.tpl.php file:

<?php if ($page): ?>
  <a href="<?php print $feed_item_url; ?>" target="_blank">Read Full Article</a>
<?php endif; ?>
galundin’s picture

If you need to store the source URL in a specific target field of the entity you're importing, you can add the URL as a new source item to the Feeds mapper:

<?php
function my_module_feeds_parser_sources_alter(&$sources, $content_type) {
  $sources['source_url'] = array(
    'name' => t('Source URL'), 
    'description' => t('URL of original article'), 
    'callback' => 'my_module_get_source',
  );
  $sources['current_uid'] = array(
    'name' => t('Current User ID'), 
    'description' => t('ID of user who is importing article'), 
    'callback' => 'my_module_get_source',
  );
}

function my_module_get_source($source, FeedsParserResult $result, $key) {
  switch ($key) {
    case 'source_url':
      return $source->config['FeedsHTTPFetcher']['source'];
    case 'current_uid':
      global $user;
      return $user->uid;
  }
}

?>

Then you'll have "Source URL" available in the Processor mapper, which you can map to any target field. (I also added the UID, to demonstrate how to add multiple sources.)

AntiNSA’s picture

any chance on having this functionality worked into views>?

lexiongxiong’s picture

Version: 7.x-2.0-alpha4 » 7.x-2.0-alpha5
Component: Code » Feeds Import
Status: Closed (fixed) » Needs work

Reply #48

Keep Show

"Notice: Trying to get property of non-object in include() (line 126 of /home/content/XXXX/themes/bartik/templates/node.tpl.php)."

On the top~

-_-!...

Copyfight’s picture

Subscribing

brks’s picture

With the present version of Feeds module (7.x-2.0-alpha5), it is easy to create a link to original source. No need to create new function. No need to edit template.php.

1. create a new field for the feed item (node), we can call it "field_original_link".
2. map "Item URL (link)" to the new field "field_original_link"
You are done now if you just want to list the original link. But if you want reader to click "full article" to visit the original web page, you may want to edit your page template.
3. print "field_original_link" to node template. Since the template does not know this new field, we will use the following format. At least one of the 2 formats will work.
$content['field_original_link']['#items']['0']['value']
or
$content['field_original_link']
Reference: http://api.drupal.org/api/drupal/modules%21node%21node.tpl.php/7#comment...

twistor’s picture

Status: Needs work » Fixed

Correct, the link from the original source is "Item URL (link)" at least for the Syndication parser.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

secgeek’s picture

Component: Feeds Import » Code
Issue summary: View changes

you can use the solution mentioned in #54 above. but if you want to make that link clickable so that user can visit the original site then use this:
1. use hide($content['field_original_link']); so that it wont display the link.
2. use following code to display the link with a href tag in you node.tpl.php file:

if($page!=0):
		$mlink = "<b>Click below Original Link to read more:</b>&nbsp<br>";
		$mlink = $mlink."<a href = \"";
		$mlink = $mlink.$content['field_field_original_link']['#items']['0']['value'];
		$mlink = $mlink."\" target= \"_blank\">";
		$mlink = $mlink.$content['field_field_original_link']['#items']['0']['value'];
		$mlink = $mlink."</a>";
		print $mlink;
	  endif;

you can see it in action at http://secgeeks.com

Thanks,
secgeek

hopfrog’s picture

It's work