Recommended coding standards?

Hi,

In 2023 I’m going to be working on my first Kirby project. It’ll be a site that aggregates together several (5+) blogs under one domain. These blogs have large archives going back as far as 2003.

I have a few questions before I get started. I want to get the architecture right, because getting half way through those archives only to find I should have done things differently will be painful.

So, what is a good approach for multiple blogs on one site? I’ve not used Kirby before (I’ve poked around at the starter kit and plain kit, but that’s it), so should I work through some tutorials first?

I’ve found the blog tutorial in the cookbook; could I follow that (and the related reading) and extend it out to the extra blogs, each under a different folder under content? E.g., content/1_first_blog, content/2_second_blog, content/3_third_blog, etc.?

I’d also like to implement curated featured posts on the homepage. What would be the best way to do that? A checkbox on the post I want to feature and some sort of query on the homepage for that checkbox = true?

Finally, I think it would be good to have an aggregated blog, that displays posts from all of the blogs in one place, and has an associated main feed. Are Collections the right tool for this job? How would you combine, say, the last 10 most recent posts from across all the blogs?

Many thanks! Looking forward to getting stuck in to Kirby.

Charles

Hi and welcome to our forum!

Yes, exactly, that would be the way to go. Additionally, it might make sense to establish a tree structure of years/months as children under each blog, depending on the number of entries per time unit.

Either that, or you let the user select the posts to show on the home page via a pages field. Whatever works best for the user.

That depends a bit on the structure you choose, e.g. year/month subpages. but basically, you would combine the relevant children/grandchildren into a new pages’ collection, sort by date and then get the last 10.

With a huge number of blog post, the thing to avoid would be to go through the index of all blogs (hence the recommendation for the tree structure).

A fast server with an SSD drive is recommended on the hardware side.

Great, thanks. I just realised I somehow entered the wrong title for this thread. It should have been something like “Questions about multiple blogs on one site”.

If I do that, how do I make sure that posts go into the correct folder automatically if a user is adding new posts via the panel?

Hm, that depends a bit on what the publishing workflow is like and how long it takes. It might be necessary to move pages depending on publication date if they can’t be put into the target folder right from the beginning.

What I don’t know is if you even need anything below year folders, if not, that would simplify things. How many blog posts will there be per year?

Average of about 20 per year.

Ok, that’s nothing, then you don’t need a tree structure. Maybe move old stuff that’s only needed for search to an archive, but otherwise, you can keep a flat structure.

1 Like

When you say move old stuff, how do you do that exactly?

You might not need it, it might just be an option if things ever get too slow with too many items in a flat structure.

You can then either move stuff manually in the file system, programmatically with hooks or cron jobs, or via the Panel with the help of a plugin (Kirby currently doesn’t support moving pages out of the box).

Great, thanks! Sounds like there are plenty of options. I’ll see how I get on and think about moving things later if needed. :slight_smile:

Hi there,

I encounter this situation fairly often, and my recommendation is the option of a pages field on panel homepage, that allows the user to select x number of posts. Using kirby’s built-in search it is fairly easy to find them.

Imo to have checkboxes on the posts themselves can get out of hand, and it is not practical, in particular when having to de-select them.

I also often implement a time-based featured pages collection, i.e. all pages with a date within the last month, and merge it with the manually selected featured pages collection. Sort by date, or in any desired way.

Hope it helps

Good luck

1 Like