-
-
Notifications
You must be signed in to change notification settings - Fork 63
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
fix: Don't deploy future blog posts in production #646
Conversation
✅ Deploy Preview for new-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for es-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for ja-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for zh-hans-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for hi-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for pt-br-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for fr-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for de-eslint ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
module.exports = collection => { | ||
let now = new Date(); | ||
const CONTEXT = process.env.CONTEXT; | ||
const showFuturePostsAndDrafts = !CONTEXT || CONTEXT === "deploy-preview"; | ||
const showDrafts = !CONTEXT || CONTEXT === "deploy-preview"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to clarify: this no longer affects future posts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this code doesn't filter out future posts from https://eslint.org/blog/ anymore because the new code in .eleventy.js
already filters out them from everywhere under the same conditions, so I just removed the now-unnecessary code from here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
Prerequisites checklist
What is the purpose of this pull request?
A future blog post is a blog post with a publication date > current date. Those posts shouldn't appear on the site before their publication date.
Currently, if we have a future blog post merged, it indeed wouldn't appear in the list of blog posts on https://eslint.org/blog/. But it's still rendered, deployed, can be accessed, and appears in the sitemap and in the list of blog posts on its category page (e.g., https://eslint.org/blog/category/case-studies/).
What changes did you make? (Give an overview)
Updated
.eleventy.js
to completely ignore future blog posts, so they won't be rendered and deployed.Related Issues
#645 (comment)
Is there anything you'd like reviewers to focus on?