WordPress.org

Ready to get started?Download WordPress

Forums

Alternate full text RSS feeds? (12 posts)

  1. bradsucks
    Member
    Posted 9 years ago #

    Is there a way I can keep my current feeds as they are (providing only summaries) but offer alternate full text feeds? Something like /feed/fulltext/ is what I'm looking for. Thanks.

  2. Kafkaesqui

    Posted 9 years ago #

    Not without some changes to the core (or a really snazzy plugin!). You could modify the script for one of the other feed types to only display full text, though. For example, for the Atom feed you could modify wp-atom.php by changing this section:

    <?php if ( !get_settings('rss_use_excerpt') ) : ?>
    <content type="<?php bloginfo('html_type'); ?>" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
    <?php endif; ?>

    to:

    <content type="<?php bloginfo('html_type'); ?>" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>

  3. AndWat
    Member
    Posted 9 years ago #

    This is a good question (and a good answer, and good hint that this would make a good plugin, from K). Some bloggers would like to offer two feeds: one with summaries and no ads; and one with full posts and ads.

  4. bradsucks
    Member
    Posted 9 years ago #

    Yeah, that's basically what I'm looking for (though I'm not too big on RSS ads.) I just won't want to give everyone full text if that's not what they're looking for. I personally prefer decent excerpts to fulltext on sites I'm only marginally interested in.

    Thanks Kafkaesqui, I'll try that and see how it works out.

  5. nickel
    Member
    Posted 9 years ago #

    You could keep your regular feed as it is, run it through FeedBurner to create a summary, and then offer that url as the one to use for summaries.

    hope this helps, nickel

  6. bradsucks
    Member
    Posted 9 years ago #

    I did some hacking around and maybe someone smart can verify that this works properly. If, in wp-rss2.php around line 41 you change:

    <?php if (get_settings('rss_use_excerpt')) : ?>

    to:

    <?php if (get_settings('rss_use_excerpt') AND $_GET['fulltext'] != 1) : ?>

    And keep the WordPress feed settings set to Summary, then going to /wp-rss2.php?fulltext=1 seems to give the RSS feed with full text.

    Any feedback on this would be great as I'm unsure about implementing it on my public site in case it breaks everything. Thanks.

  7. bradsucks
    Member
    Posted 9 years ago #

    I decided to go ahead with this, so maybe I should explain how I'm implementing it. Instead of hacking wp-rss2.php which will get overwritten every time I upgrade WordPress, I decided to copy that file to wp-rss2-fulltext.php.

    Then inside of that I deleted lines 41-43:

    <?php if (get_settings('rss_use_excerpt') AND $_GET['fulltext'] != 1) : ?>
    <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
    <?php else : ?>

    And also line 50:

    <?php endif; ?>

    Then I put this line in my .htaccess file:

    RewriteRule ^rss2/fulltext/?$ /wp-rss2-fulltext.php [QSA,L]

    Now your blog URL plus /rss2/fulltext/ should give you the full text RSS 2.0 feed for your blog, like this:

    http://www.bradsucks.net/rss2/fulltext/

    Hope that helps anyone trying to do this. If anyone has any feedback, I'd love to hear it.

  8. manstraw
    Member
    Posted 8 years ago #

    I tried that out. The only thing is it's necessary to leave off the first "/" in the rewrite destination, as in:

    RewriteRule ^rss2/fulltext/?$ wp-rss2-fulltext.php [QSA,L]

    RewriteBase should be specified near the top. Change that if your blog moves to another dir.

    One thing I'm wondering is if a new wordpress upgrade will override the .htaccess file/

    I would like to see this effect as a plugin. I've only written one plugin so far, and am not sure how this would be done. Is there a hook for the rss feed? Perhaps one could change the value of rss_use_excerpt based on a get parameter.

  9. ptp
    Member
    Posted 8 years ago #

    Resurrecting this thread... *newbie question* is there a way to set a rewrite rule based on who's asking? I'd like to set up a full-text atom feed just for Technorati, and leave everything else alone... Anyone know of an easy way to do this?

  10. manstraw
    Member
    Posted 8 years ago #

    You have a variety of conditions you can specify as to whether or not the rewrite rule is followed.

    Here's a page that 'splains that: http://www.html4.com/mime/markup/php/how_to_en/how_to_system_en/how_to_system_8.php

    Just to show you the format, this is what I do to stop certain bots from seeing the my site:

    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]
    RewriteCond %{HTTP_USER_AGENT} ^Zeus
    RewriteRule ^.*$ http://www.microsoft.com [L,R]

    I could use that technique to send different browsers to different pages.

    You'll probably want to explore the referer and host conditions.

  11. mkess1957
    Member
    Posted 7 years ago #

    Kafkaesqui, re: your suggestions above -- yesterday, I updated my wp-atom.php file to Atom 1.0 using the guidelines from G-Loaded.) After doing G-Loaded's fix, my Atom feed validated. Today, I did as you suggested in your first comment above. After I did that, though, I ran it through the W3C validator and it wouldn't validate. The validaor said there were a lot of errors, mostly </div> tags appearing without being preceded by <div>. Any suggestions on why this happened and how to fix it? I'd like to have full Atom feeds, for Technorati. My site is at http://buckandmike.com .

  12. mkess1957
    Member
    Posted 7 years ago #

    Me again, several hours after posting the comment above. First, let me say I didn't realize where the radio button for full text feeds was on the WP Dashboard until a few minutes ago. I checked it off, and then went the W3C atom feed validator, and got the same response as above -- apparently, the changes I made using G-Loaded's fix work fine for an Atom summary feed, but not for an Atom full feed.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags