Secret RSS Club!

It's a secret to everyone! Read more about RSS Club.

Awesome! You’ve joined the super-secret RSS club! You will be able to read RSS-exclusive content. Started by Dave Rupert who also established a few rules, which I will repeat here, just in case you want to join too and we’re all on the same page.

How to participate

  • 1st rule of RSS Club is “Don’t Talk About RSS Club”.
  • 2nd rule of RSS Club is “Don’t Share on Social Media”.
  • 3rd rule of RSS Club is “Provide Value”.

Don’t talk about it. Let people find it. Make it worthwhile.

What's in it?

The RSS feed will probably additionally the "public" posts contain also more non-work-unrelated things. Like short reviews, ideas, opinions and such. I don't know for sure, I'm probably as excited to find out as you are. You are excited, right? Oh.

How to show posts only in the RSS feed for Kirby?

You want to join too, and use Kirby? Great! Keep reading. This is for you. Let’s make this a secret big thing!

First, you'll need a checkbox in the panel. So add this field to the blueprint of your article.

  rssOnly:
    label: RSS Only
    type: checkbox
    text: Include this post in RSS only

Then, you'll need way to A: get all visible posts including rss-only, B: get all visible posts excluding rss-only posts. I like to add these kinds of methods to the Model of the page, so I can simply use page('blog')->articles() and page('blog')->articles(true). In Kirby we use models to do that.

<?php
// file: site/models/blog.php

class BlogPage extends Page {
    function articles($includeRss = false) {
        return page('blog')
            ->children()
            ->visible()
            ->filter(function($p) use ($includeRss) {
                if ($includeRss) {
                    return true;
                }

                return $p->rssOnly() != '1';
            })
            ->sortBy('date', 'desc')
         ;
    }
}

After that you'll need to use that method in appropriate places. eg. in a blog controller:

<?php
// file: site/controllers/blog.php
return function($site, $pages, $page) {

  $perpage  = $page->perpage()->int();
  $articles = $page->articles()
                   ->flip()
                   ->paginate(($perpage >= 1)? $perpage : 5);

  return [
    'articles'   => $articles,
    'pagination' => $articles->pagination()
  ];
};

End
Start over

Currently available for exciting projects.