Custom route with posts data

I’m using Ghost 3 and I’m trying to make a custom route which should have the same data (posts) available as the index-route has.

I tried to make my yaml like below, but I get a 404 error when I go to allposts. I do have created an allposts.hbs file so it should

routes:
  /allposts/:
    data: page.home
    template: allposts

collections:
  /:
    permalink: /{slug}/
    template: index

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

allposts.hbs

    <div class="post-feed">

        {{#foreach posts}}

        {{> "post-card"}}

        {{/foreach}}

    </div>

Are you using the uploader in admin to upload your routes.yaml file?

Hi Kevin,
Yes exactly, if I remove the
data:page.home
In my yaml file my page is loading correctly so seems that the uploading is working correctly.

Cool, was just checking in case the file was being edited directly :slight_smile:

Have you created a page with the slug home for the route’s data to be pulled from?

Ehhh, seems like a bit of a rookie mistake on my part, I haven’t made a slug, however m aybe it makes sense instead to just present my intent with the custom route:

  1. I want the index.hbs to show just the 3 most recent posts, no matter which author. This works :+1:
  2. I want a separate page allposts to show all the posts that has been made, no matter which author.

Thanks for the quick responses Kevin :heart: