Comments (5)
I'm planning to optimize quite a lot in the coming weeks and will try and include that. I'll let you know!
from eleventy-excellent.
Thanks looking into this. I admit that I hadn’t put aside time to look into this myself so I appreciate it.
I do like the idea of drafts that are previewed during development but not published when built
from eleventy-excellent.
@flamedfury
I solved this by editing the getAllPosts
const in /config/collections/index.js
like this
const getAllPosts = collection => {
const now = new Date();
const publishedPost = post => post.date <= now && !post.data.draft;
const projects = collection.getFilteredByGlob('./src/posts/*.md').filter(publishedPost);
return projects.reverse();
};
This also stops building posts that have a date set in the future, ie. it schedules their publish date.
from eleventy-excellent.
The question is, do we want a draft system that still allows a preview of the article in development mode, or is it enough not to build the draft article at all, as is the case here?
from eleventy-excellent.
this was just an example how I made it for my usecase so that Flamed can decide how they want to possibly implement it on their end :)
for a more general solution for the starter, I think it makes sense to build draft posts during development.
Perhaps by setting an environment variable in the dotenv file or directly into the package.json dev script would make sense.
Another option would be to check if eleventy is running using --serve and then show/hide based on that. Personally I'd prefer some option that is easy to turn on/off for development so that I can confirm that drafts are indeed excluded before pushing the site for build.
from eleventy-excellent.
Related Issues (20)
- Suggestion: Add github public template button HOT 1
- Remove Minification HOT 2
- Date language HOT 5
- Fantastic (EXCELLENT!) template! Looking for TAGS support for post HOT 3
- How to link to full size image? HOT 4
- sitemap.xml generated urls from src/assets css and js HOT 1
- Tailwind classes in HTML markup don't work HOT 2
- Plugin Warning HOT 3
- imagePlaceholder fallback doesn't work HOT 1
- OG images don't work with webfonts HOT 2
- Broken OG Images HOT 1
- Middle-click usability issue with clickable cards HOT 6
- Post Tags on Blog Cards HOT 2
- Dark theme custom colors don't render. HOT 2
- How do you update a template? HOT 2
- Partial -> Meta-info.njk (Description and Personal.Platforms Corrections) HOT 1
- adding a license? HOT 2
- Incorrect URL on the about page HOT 2
- On the issue of dependencies vs devDependencies HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eleventy-excellent.