Comments (6)
My general idea was that the script would:
- load draft file
- split file into a front matter object and content
- check if there is a date field already and prompt to verify if user wants to overwrite it
- add date field to front matter object
- create a new file with updated front matter and the content
But unfortunately, I haven't had time yet to take a look at how complicated it might be to implement.
from jekyll-compose.
I had a go at implementing this but I can't see a good way to solve this without introducing code that could destructively alter source files and cause unexpected behaviour with posting dates.
The easiest nearly fix would be to add a date to a draft when it is created, but this then causes problems publishing with the --date
option as the two dates may disagree. Even having a unique sentinel like value to find and replace with the publish date wouldn't work if a post was published then unpublished.
Parsing source files and altering their contents seems like a recipe for breaking or losing posts. Maybe publishing could try to set the published date in the front matter and not remove the draft so the original isn't lost, but it could still cause lost or corrupted posts so would need to try to explain this to the user every time they published... yuck.
Do you have a better idea I've missed?
from jekyll-compose.
My general idea was that the script would
I think this is the right approach
from jekyll-compose.
If you like, take a look at #63.
from jekyll-compose.
Hmm, instead of altering the file contents as well with publish
and unpublish
, what about a separate jekyll touch
command?
It can alter any post, draft or not. Jekyll seems to prefer the yaml front matter over the filename for posts, so jekyll touch
doesn't need to move the file for the new date to apply (and jekyll unpublish
then jekyll publish
would move the file to the current date).
All the logic for prompting the user and/or making backups before editing files would be handled by that command, and not mixed with publish and unpublish.
Downside: in some cases, more than one command is needed to publish a draft. Also, published posts with dates that are unpublished with a date must be touched to be correct.
Upside: simplifies publish
and unpublish
. Editing file front matter (or even contents) can then be used by another command and the prompting/backup behaviour can be shared. e.g: renaming posts, additional front matter, a edit command to open EDITOR?
from jekyll-compose.
Has PR #63
from jekyll-compose.
Related Issues (20)
- Default to listing available drafts HOT 1
- Using templates for new posts HOT 1
- Does not handle category subdirs correctly HOT 2
- Time for a new release HOT 1
- Allow to omit the layout HOT 2
- Time for a new release HOT 1
- Time for a new release HOT 1
- post to subfolder HOT 1
- Time for a new release HOT 1
- Time for a new release HOT 1
- `Tried to load unspecified class: Time` when running jekyll unpublish HOT 12
- Time for a new release HOT 1
- Time for a new release HOT 1
- Windows 11 : auto_open : true broken when file path has spaces HOT 1
- Time for a new release HOT 1
- Time for a new release HOT 1
- VCS-aware compose commands HOT 1
- Time for a new release HOT 1
- Editor opening issue HOT 1
- Time for a new release
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 jekyll-compose.