Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: option to skip processing on pages with future dates #271

Closed
edwardhorsford opened this issue Oct 6, 2018 · 3 comments
Closed

Idea: option to skip processing on pages with future dates #271

edwardhorsford opened this issue Oct 6, 2018 · 3 comments
Labels
open-question Requires additional information before we can proceed.

Comments

@edwardhorsford
Copy link
Contributor

I read this interesting blog about using daily deploys on netlify to 'schedule' blog posts.

Essentially the posts are given a date in the future, and the static site generator doesn't process them until that date is in the past. The author set up Netlify to redeploy his site daily - so when the post he'd already pushed eventually had a date in the past, it gets rendered that day.

I think you could probably do this now with Eleventy using permalink=false and some javascript testing for the current date - but not very cleanly as the templates need extra code to make it work.

Cleaner would be config in eleventyConfig - which people could make conditional depending on whether they're running in production or dev

Possibly if draft support comes to eleventyConfig, that might support this too. Something like:

eleventyConfig.ignoreFiles(function(file) {
    return (process.env.DRAFT === 'true') ? false : page.date > currentDate;
  });
@zachleat
Copy link
Member

zachleat commented Oct 7, 2018

Hmm, to me this seems like a duplicate of #188?

@zachleat zachleat added the open-question Requires additional information before we can proceed. label Oct 7, 2018
@edwardhorsford
Copy link
Contributor Author

Yeah, possibly - depending on how #188 is implemented. If you think they're close enough I'll close this.

If it's possible to do in eleventyConfig it might be nice to have a section in the docs showing what code you'd need.

@edwardhorsford
Copy link
Contributor Author

I should add - I'd be happy to put in PR to add something to the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-question Requires additional information before we can proceed.
Projects
None yet
Development

No branches or pull requests

2 participants