Scheduled posts from timeline yaml #3584
Replies: 2 comments 2 replies
-
This would also be very useful for e.g. course websites, where you don't want to overwhelm students at the beginning of the semester (so you only want content that is initially relevant) but you have the whole course prepped ahead of time. It would also make changing dates for an entire semester at once much easier. |
Beta Was this translation helpful? Give feedback.
-
@srvanderplas I figured out a way to implement this using R scripts that are run before I run The key idea of the script is to read the yml file and prepend |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a blog that I'd like to publish on a schedule, with the publishing dates stored in a file that's separate from the posts. It seems like the scheduling question would be well-addressed by the filter described in #3114. What is the best approach for propagating the date information into the documents or into the render process?
I've put together a repo that explores a couple of different approaches to this.
https://github.com/andrewpbray/scheduled-posts-options
They're described in the README and I've copied them here below. It strikes me that this is a version of a more general question: what's the best way to render documents subject to document-specific metadata that is held in a separate file?
The three approaches below reference a
_schedule.yml
that would look something like this:1. YML injection via .md file created in pre-render script
Write a pre-render script that parses
_schedule.yml
and creates a tiny_publish-date.md
file next to each post that adds to the metadata via an include. This is quasi-implemented in Topic 2.Downsides:
2. Reference _variables.yml in document YAML
Create a
_variables.yml
file that includes the publish dates for each post. That variable is then referenced in the yaml header of the post. This is implemented in Topic 3 (though apparently I've formatted the date field incorrectly).A similar use case is discussed here.
Downsides:
3. Write a filter
Changing the meta data of a documents seems solidly within the functionality of a filter. The wrinkles that I see here:
_schedule.yml
. Is there an example of a filter that does this that I could look at?_schedule.yml
links the publish date with the file / directory name of the post. I'm not sure how to reference that information in the filter. Would it make more sense to reference thetitle
field in the yaml?Beta Was this translation helpful? Give feedback.
All reactions