fermyon / bartholomew

The Micro-CMS for WebAssembly and Spin
https://bartholomew.fermyon.dev/
Apache License 2.0
411 stars 50 forks source link

Set a publish date at fragment level not just page level #178

Open itowlson opened 1 year ago

itowlson commented 1 year ago

Consider the following not entirely hypothetical scenario:

But if we future-date a page and merge it together with its TOC entry, the TOC entry is dangling! So we have to fall back to some unfortunate individual, say in Australia, having to stay up into the small hours to merge it at the right moment.

A possible way out of this would be to allow fragments to have publish dates. Then the TOC entry could be timed for the same moment as the new page.

This could also help with page changes, where you want to add a piece of content to an existing page, but only have that content appear at the prescribed time.

The downside of this approach is that if publish-by dates are kept around, pages end up as a mass of "hide until 4 October 1973" scar tissue, so users of this feature would need to be diligent about cleaning up! So if there is a more self-sustaining way to do this then that would be even more betterer...!

karthik2804 commented 1 year ago

This is already possible with the help of rhai scripts since this PR was merged.

It would require the content in question to be wrapped with an if statement calling a rhai script that returns if the the current date exceeds the set date.

itowlson commented 1 year ago

Oooh! Nice!