Collection with two elements for each blog post

I’m working on a blog-type website for a client who wants the homepage of the website to be a randomized collection of all posts on the site. But instead of a simple list of headlines linking to a different post each, they want it to be made up of fragments from articles as separate elements (for each article: one from the title field, and one the intro field, both linking to the same article).
What’s more is that this collection should also include images that are not related to blog posts but should each be treated as yet another element in this collection. They should be able to be filtered by different fields (i.e topic or author).

-> In short: Landing page should have three kinds of separate elements in random order (headlines, intros and images). One headline and one intro for each post, as well as some unrelated images. I hope this makes sense.

I’ve set up a basic post blueprint with a couple of fields like topic, format, text, author etc, but am still wondering how to best approach the task on hand. I thought I could maybe use a collection where each post appears twice, but I don’t really have a clear vision what to do… I’d be happy about any suggestions.

All the best :~)


Currently have this as a controller:

// site/controllers/posts.php

return function($site) {
    $entries = $site->find('archive')->children()->listed();

    $clones = new Pages;

    foreach ($entries as $entry) {
        $clone = Page::factory([
            'slug' => $entry->slug(),
            'template' => $entry->template(),
            'url' => $entry->url(),
            'content' => [
                'title' => $entry->intro(),
                'topic' => $entry->topic(),
                'author'=> $entry->author(),
                'format'=> $entry->format(),

    $posts = new Pages(array($entries, $clones));

    $posts = $posts->shuffle();

    return $posts;

This gives me a Pages object that has two instances of each actual page in it, and I can change the needed values accordingly.

I can probably also chuck the needed images in there somehow.

Still, if there’s a better approach, feel free to let me know :~) I’m worrying a bit about performance of this approach with shuffling, because it will be quite a few posts in the end…

I’m just wondering what this means from an accessibility and usability point of view with all these duplicate links.

Hmm, good point. I hadn’t imagined it to be a concern, but I’m far from an expert on this topic…