How do I add the year of publication before the slug in the post URL

Hi,

Sorry if this has been asked before, I did search before posting my quetion, but either I am not using the right wording, or the question has not been asked.

I have created a colelction to house all my news articles:

....
  /news/:
    permalink: /news/{slug}/
    template: news
    filter: tag:hash-newsletter
....

I have made a test post and everything is working fine, the posts are even groups in with the public News tag, so that they all appear in the correct tag archive, and additional posts are being recomended at the bottom of each post.

So far, so good.

However, I want to add the year each post was published into the post URL. I have tried doing this with in the routes file, by doing this:

...
  /news/:
    permalink: /news/{YYYY}/{slug}/
    template: news
    filter: tag:hash-newsletter
...

However, that does not work. When I try to load a post the URL cycles between yyyy and YYYY and then the page fails to load. What I mean is, the letters “yyyy” and “YYYY” appear where the year should be and then the page eventually fails to load.

How do I add the year of publication into the post URL before the slug. I only want the year to be shown, and I only want this to happen on the posts in the news collection

Thanks

Jay

NB:

Sorry for the formatting and spelling, I am using a mobile device right now.

So, I think the solution is an easy one: instead of using {YYYY}, you need to use {year}.

Here’s list of all available properties: Ghost Themes - Dynamic URLs & Routing