Hi,
I have deployed a website completely managed with Soupault at
https://www.myowndb.com (feel free to add it to the list).
I include a blog section, and I would like to write blog posts in
advance, but have them only published at their respective publication date.
Each post has a publication date that I succesfully use in the index,
and that could be used in a test to decide if the post should be
published or not.
But I haven't seen a way to do it. Additionally a post not yet published
should not have its page built but should also be excluded from the index.
Is this possible with Soupault?
Thanks
Hi Raphaël,
This is an interesting question. The usual way to skip a draft page is
to use the `settings.ignore_extentions` option,
but that's purely static and won't work for your idea.
What could work is the save hook
(https://soupault.app/reference-manual/#hooks-save).
You could check the date from the index entry there and just do nothing
if the date is in the future.
There's https://soupault.app/reference-manual/#Date.to_timestamp to
convert dates to UNIX timestamps for easy comparison,
ignoring the issue of timezones (I intentionally decided not to open
that can of worms ;).
The only problem is that the `save` hook doesn't have access to the
`index_entry` variable now.
That's just because I thought there were no use cases for that, it
should be easy to add.
(You'll also need to set `index.index_first = true` so that all pages
have access to their own index entries)
If you tell me which OS you use soupault on, I can make a preview build
with that within a couple of days.
I've been planning to make 4.8.0 release soon anyway — there are a few
useful additions,
but I got overwhelmed with other things so the release got pushed back.
On 11/20/23 16:59, Raphaël Bauduin wrote:
> Hi,
>
> I have deployed a website completely managed with Soupault at
> https://www.myowndb.com (feel free to add it to the list).
> I include a blog section, and I would like to write blog posts in
> advance, but have them only published at their respective publication
> date.
> Each post has a publication date that I succesfully use in the index,
> and that could be used in a test to decide if the post should be
> published or not.
> But I haven't seen a way to do it. Additionally a post not yet
> published should not have its page built but should also be excluded
> from the index.
>
> Is this possible with Soupault?
>
> Thanks
>