Calculating with Dates on Creation

I have a customer who offers a tour every last week of the month. Up to now I am recreating the site every month and remove the month gone from the list. What would be a nice way to automatically on creation not include dates below TODAY() to a list of items (output) if it’s in the past? I am pretty sure that might be possible with some Go-Date-Wizardry… This way I could just let Netlify recreate the site once a day.

You can either:

  • Set expiryDate in front matter
  • Use where with something ala {{ range where .Pages “Date” “<” now }}
1 Like

Hmm, no, it’s not pages per tour, it’s one single page with an array of dates (maybe per frontmatter). So this might not work.

On the other side, you got me having an idea here. I could just create a folder with dates that will be loaded into the tour page. And then expiryDate would work quite well.

Waaaaait… or even a /data/-file…