Syndicated content has almost become the standard way of distributing web content nowadays. WordPress can deliver its content in various different feed formats -RSS 2.0, Atom 1.0, RDF, RSS 0.92- and can generate feeds for both the published posts -grouped by time, category, tag, author etc- and the comments that have been submitted by readers. Moreover, some RSS add-on modules are being used in the generated feeds, so that modern feed readers can even retrieve the submitted comments for each of the feed entries. It is obvious that all these features greatly enhance the user experience, but, on the other hand, depending on the website’s traffic they might increase the server load and thus the content delivery times.
Taking these things into consideration, I decided to write Fast-Static-Feed, a plugin that can cache the site’s entries feed, and deliver a static XML file instead of constantly generating the feed content on every client request. This, combined with the fact that the web server can compress the web content on-the-fly, has greatly reduced the waste of bandwidth and system resources.
How it works
Fast-Static-Feed performs the following actions:
* Every time a post is published or an already published post is edited, the plugin dumps the entries feed (that is the feed of the blog posts) to a file. This way, the static XML file is always contains the most fresh content of your blog.
* Every time a feed is requested, instead of re-generating the XML content over and over, this plugin delivers the static XML file. This is completely transparent to the client as there are no HTTP redirects involved. Your content is just being delivered faster!
* If the plugin is enabled, but the static files have not been created yet, the plugin will try to generate them automatically. Upon failure to do so, a 404 Not Found HTTP error code will be returned to the client.
* It also checks if the client’s request includes the If-Modified-Since HTTP header and, in such a case, it checks the static file’s modification time. If the client’s cache is current, it just returns a 304 Not Modified status to further reduce bandwidth usage.
The plugin caches all four types of feeds WordPress supports -RSS 2.0, Atom 1.0, RDF, RSS 0.92-.
Only the feeds that contain your latest blog posts are cached. The comments feed, each individual post’s comments feed, feeds for categories, tags, authors etc are still generated dynamically every time they are requested.
This plugin does not interefere in any way with the generation of rewrite rules and the generation of your site’s feed links.
Configuration
Generally, the plugin does not require any configuration in order to work.
One mandatory prerequisite is that the wp-content/ directory is writable by the web server. If it is not, the plugin will not be able to create the static files and, consequently, the clients who request a feed will receive a 404 Not Found HTTP code.
Furthermore, there are two options within the source code fast-static-feed.php that can be set.
// By default, the WordPress feeds contain elements of the wfw namespace
// (CommentAPI), so a feed reader can fetch each feed entry is comments.
// By setting the following to 1, these elements will be stripped
// from the static feed.
// It is recommended to set this to 1 in order to save bandwidth.
// More info: http://wellformedweb.org/news/wfw_namespace_elements/
$FSF_STRIP_COMMENTS = 0;
// Set the following to 1 and various messages will be recorded in the logfile,
// which is located in the cache dir (wp-content/cache-xml/)
$FSF_DEBUG = 0;
It has already been mentioned, but it is important to note it again: The only mandatory prerequisite is that wp-content/ is writable by the webserver.
Installation
Make any changes to the configuration options within fast-static-feed.php and upload the file to wp-content/plugins/ directory. Then, activate the plugin through the WordPress administration panel.
source: g-loaded
Related Stuff
New WordPress feature, Possibly Related PostsIf you have a blog on WordPress.com, you may have noticed a new feature called Possibly Related that links posts from other blogs in the ...
What Do You Need to Set up a Wordpress BlogI've found myself answering this question a lot lately, so I figure I should just turn it into a blog post so I can point people to ...
How To Make a WordPress Privacy PolicyEver since Adsense updated their terms and conditions, requiring publishers to display a privacy policy on their website(s), webmasters and ...
WordPress Single Post TemplatesAustin recommends using a filter in your functions.php file as an alternative to the method below. IMO, his suggestion is much simpler and ...
Wordpress Plugin - SuperFast Digg ThisSuperFast Digg This is really a super fast social bookmarking plugin, it loads faster than others, scalable and with better performance. It ...
Be the first ... |Add your comment.
Your Comment ...
Name (required)
Email (required, hidden)
Website
