Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
SiteDateTime setting to filter published blog posts #859
Currently BlogPosts pipeline renders only posts, which have
I suggest to add setting named SiteDateTime (or GeneratedDateTime) with default value
I see 2 use-cases, with providing this setting from command-line:
Good point , I will think about it. Although very first idea is that
And here are some points to assume both values are in same time zone:
This is my suggestion split to 3 steps:
Step 1: Published metadata
Actually this step is "no change". Currently Published metadata value is entered in format
And I suggest to keep it that way. Other option would be to extend the metadata value to format
Step 2: SiteDateTime setting
It is possible to set setting value SiteDateTime. Value is of type date time optionally with time zone offset. For example in format:
Step 3: Filter unpublished blog posts
Only blog posts with Published metadata value earlier than SiteDateTime setting. If the setting is not specified, then
This is my suggestion. Feel free to comment, which of the details should be different.
And this is proposed use case with CI/CD. Example of PowerShell script to build website in time zone with offset +7.
$utcNow = [System.DateTimeOffset]::UtcNow $localTime = $utcNow.ToOffset([System.TimeSpan]::FromHours(7)) $localTimeString = $localTime.ToString('O', [System.Globalization.CultureInfo]::InvariantCulture) $settings = "SiteDateTime=$localTimeString" & wyam --setting $settings
Maybe the script can use be extended to work with NodaTime to use specific time zone data and deal with day-light saving time.
I like this idea - it makes total sense to allow the site generation to seem like it's taking place at some time other than
NodaTime is a definite no. I try to keep the dependencies in the core libraries to a bare minimum. It's probably a good idea to transition all
Agreed - I don't want authors to have to specify a time zone.
If I recall it does a
The rest of @duracellko proposal looks great. I'll get this into the first Statiq release.
@duracellko I certainly don’t want to discourage you from contributing! That said, a PR to the Wyam repo has a very low chance of being merged right now. Statiq is far enough along that PRs here won’t port that well and I’m not planning another Wyam release unless an urgent patch is needed.
Hold on to the idea for a few weeks while Statiq finishes up and then we’ll revisit in that codebase to make sure this makes it into the initial release.