statamic / ssg

The official Statamic Static Site Generator
229 stars 23 forks source link

SSG should skip entries that are future dated #132

Open tao opened 1 year ago

tao commented 1 year ago

I just got an error on my site because SSG tried to publish a news article that was set to be published later on.

I see there is a filter to check if the page is published:

    public function isGeneratable()
    {
        return $this->content->published();
    }

Maybe we can add a filter to check if the content is also meant to be published now or in the future?

    public function isGeneratable()
    {
        // if ($this->content->date && $this->content->date()->isFuture()) return false;

        return $this->content->published();
    }

But I'm not sure if we need additional checks to see if the content is an Entry, and not a page, taxonomy, whatever collection type that doesn't have a date.