statiqdev / Statiq.Web

Statiq Web is a flexible static site generator written in .NET.
https://statiq.dev/web
Other
1.64k stars 235 forks source link

Add a CurrentDate metadata field and use it instead of DateTime.Now/Today #910

Open daveaglick opened 4 years ago

daveaglick commented 4 years ago

Right now DateTime.Today is used to determine if a page/post has a future publish date (and therefore should be excluded). Instead of basing that on the current date, use a metadata key of CurrentDate which defaults to DateTime.Today but can be set to any date in the future to preview pending changes.

See https://github.com/statiqdev/Statiq.Web/blob/75c9620d334040aef64d6fed01587e8879e1e79e/src/Statiq.Web/BootstrapperExtensions.cs#L81