how to change autodiscovery links to point to feedburner

mrmachine - September 6, 2005 - 23:03

i haven't seen a simple answer to this question anywhere:

from where are the drupal html headers generated, specifically the autodiscovery URL?

i need to change this:

<link rel="alternate" type="application/rss+xml" title="RSS" href="http://blog.machinehasnoagenda.com/feed" />

to this:

<link rel="alternate" type="application/rss+xml" title="RSS" href="http://feeds.feedburner.com/machinehasnoagenda" />

i guess this means replacing a variable with the static information above - but i've searched relentlessly and can't find where to do this ... shouldn't it be set in xtemplate file (i got the code above from "view source" in firefox)?

how to change autodiscovery links to point to feedburner SOLVED

mrmachine - September 7, 2005 - 22:04

i haven't seen a simple answer to this question anywhere

well, here it is:

1. open modules/node.module in your editor of choice.

2. at around line 1619, find this code:

  if (db_num_rows($result)) {
    drupal_add_link(array('rel' => 'alternate',
                          'type' => 'application/rss+xml',
                          'title' => 'RSS',
                          'href' => url('node/feed', NULL, NULL, TRUE)));

and replace it with something like this:

  if (db_num_rows($result)) {
    drupal_add_link(array('rel' => 'alternate',
                          'type' => 'application/rss+xml',
                          'title' => 'machinehasnoagenda - blog',
                          'href' => ('http://feeds.feedburner.com/machinehasnoagenda')));

5. you're done!

this works for me. i have no idea if this is the proper way to do it.

http://www.machinehasnoagenda.com

What about multi-site setups

Zach Harkey - November 23, 2005 - 03:20

What about multi-site setups where many domains share the same module? I can't hardcode the feedburner href because all the sites will inherit this.

-zach
------------------------
harkey design

Here is another solution

Zach Harkey - November 23, 2005 - 04:11

Here is another solution that can be done at the template level.

In your page.tpl.php, replace

<?php print $head ?>

with

<?php print str_replace('http://example.com/node/feed', 'http://feeds.feedburner.com/example', $head) ?>

I think it's better because it doesn't require hacking node.module and also works for multi-site setups.

-zach
------------------------
harkey design

Works very well, thanks

danubetech - February 19, 2006 - 18:43

This works great. For those you new to PHP (or rusty like me) here's a link on how to get this to work for mult-sites using arrays:

http://us2.php.net/manual/en/function.str-replace.php#60628

Yes Great Answer

xybermatthew - February 2, 2007 - 05:20

This worked like a charm in v 5.x! Now I just need to figure out how to get the rss feed link onto all pages.

rss feed link on all pages

drupal-is-OK - February 12, 2007 - 14:42

Any luck with this? i've not seen how to change the rss logo a tythe bottom of my menu on each page to display my feedburner rss vs. my drupal one

uofl forum

Multiple feeds?

tuti - March 11, 2007 - 16:49

What if you have different feed for different pages?

How do you add another internal drupal feed link that I want to replace with another feedburner link to that feed?

 
 

Drupal is a registered trademark of Dries Buytaert.