Create a Blog RSS feed

The blog templates include a template which outputs the post in a format as needed for an RSS feed. To use it, you will need to create a page just like any other. This will be a blank page though without any of your site design involved. Create that in the blog folder and call it rss.php.

The entire code for rss.php is below. To see a walkthrough of this code watch the video (which has captions). The code uses a template from the perch/blog/templates folder, named rss_post.html. The default may well be all you need but you can make changes to it as with any other template.

<?php include('../perch/runtime.php'); ?>
    $domain = 'http://'. $_SERVER['HTTP_HOST'];

    header('Content-Type: application/rss+xml');

    echo '<?xml version="1.0"?>';

<rss version="2.0" xmlns:atom="">
        <title>Blog | Swift Migrations</title>
        <link><?php echo PerchUtil::html($domain) ?>/blog/</link>
        <description>News from Swift Migrations</description>
        <atom:link href="<?php echo PerchUtil::html($domain) ?>/blog/rss.php" rel="self" type="application/rss+xml">