0

I am using the Feeds module to publish the contents from a Wordpress blog to my site's home page. I'd like to have the items on the home page link directly back to the original blog rather than the nodes that the Feeds module creates. Is this possible? If so, how do I do it?

0

I'm assuming you're using an RSS/Atom feed, and that you're using the node processor in your feed importer. In your feed importer settings, you can edit the node processor mappings. Add a mapping from the "Item URL (link)) to some text field in the content type you import to. Then you can use that field to create links back to the external url in views, and in the template files for the content type.

Once you have the url field, go through the following steps.

  1. create a view of feed items. /admin/structure/views/add

    a. select "show CONTENT of type Feed Item". You can create a block or a page. Either way:

    b. select "display unformatted list of fields"

    c. click "continue and edit"

  2. add fields.

    a. add Feed item URL. select "exclude from display".

    b. add content title. Make sure it appears after the feed item url in the fields list. Select "rewrite results", then "output this field as link". Click on "replacement patterns" to reveal the tokens you can use. Insert the token for "feed item URL" in the "link path" field, and select "external URL". Save the view.

  3. if you've created a page, you'll need to give it a path. If you've created a block, you need to go to structure > blocks and assign the block to a region.

Hope that helps.

  • Your assumptions are correct. But I'm not sure if I follow you correctly. I go to Home > Administer > Site Building > Feed Importers and click on "Mapping" under "Node Processor." I see the Item URL option under sources, but I don't see a text option under "Target." – jimchristie Feb 21 '14 at 13:39
  • You need to add a text field to your target content type. Then it should appear in the importer mapping settings :) – Ollie Feb 21 '14 at 13:45
  • Ok, I see that now. Could you elaborate on how I use the text field to create links back to the external URL? Sorry, I'm still pretty new to Drupal. – jimchristie Feb 21 '14 at 14:29
  • For example, you can create a view of feed items, pull in your url field and the title, and then rewrite the title field so that it becomes a link to the original post. The order of the fields is important: url field first. When you rewrite the title field, choose "view available tokens" to find how to reference the url. Then rewrite as <a href="[url_field]">[title]</a>. That's just one example. You can also fetch your url field in php, and use it as the href of a list in php-generated blocks, or in template files. – Ollie Feb 21 '14 at 15:24
  • I think I'm almost there. The only hiccup that I'm still having is that the title field is grayed out and I can't edit it. I'm looking at it in Home > Administer > Content Management > Feed Item. Is there somewhere else that I should be looking for it? – jimchristie Feb 21 '14 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.