Issue with dynamic routing and route config

Hello,

I am using Ghost v3 and I am trying to get my head around dynamic routing. My goal is to create a route where all posts of a specifc year are listed. I’ve come up with this routes config:

routes:
  /archive/2018/: 
    template: archive
    controller: channel
    filter: "published_at:>'2017-12-31'+published_at:<'2019-01-01'"
collections:
  /:
    permalink: /{slug}/
    template: index
taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/

Now, when I open “/archive/2018/” I get redirected to the first post of my blog.
I played a little bit around and found out that the following config works:

routes:
  /y/2018/:
    template: archive
    controller: channel
    filter: "published_at:>'2017-12-31'+published_at:<'2019-01-01'"

Why is /y/2018 working and /archive/2018 not? Please help!

Hi @mkre. I’m not really sure why this wouldn’t be working, unless you already have something using that URL or you’re using some sort of redirect pattern? I just tried on a test blog to show all the posts from 2019 with the following config and the URL /archive/2019/ worked fine for me:

routes:
  /archive/2019/:
    template: archive
    controller: channel
    filter: "published_at:>'2018-12-31'+published_at:<'2020-01-01'"

Hey @DavidDarnes , thanks for the reply. Found out that it was a browser caching issue. :see_no_evil: Now it works!

1 Like