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 FoundHTTP 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 Modifiedstatus 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 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.
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's 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.
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.
Fast-Static-Feed is an open-source project, released as Free Software under the terms of the Apache License version 2.
Downloads, Issue Tracking, Support
The development website also hosts an issue tracking facility, where you can submit your feature requests or report bugs, and discussion boards, where you can get first class support from the community of users.
This plugin is released as free software. Nevertheless, its development requires time and effort. A small donation, as a sign of appreciation of the effort, is welcome. Please, use the following button to visit the Donations page. Thanks in advance for your support!
Fast-Static-Feed WordPress Plugin by George Notaras is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Permissions beyond the scope of this license may be available at Licensing Information.
Copyright © 2008 - Some Rights Reserved