distill blog posts workflow

I am seeking advice on a workflow for drafting articles with distill. When I get started with a blog post, i use

distill::create_post("draft-x")

which automatically assigns the folder/slug that name and today's date.

After some days tinkering, I'll settle on the post, the title, and I'll be ready to publish. Is there a good way to update the title, date, slug, etc., on the draft folder, or do I need to create a new folder and copy everything over? It seems that the distill::update_post() function only works on imported posts, and not posts created within distill. Am I missing something?

Thanks!

3 Likes

Hi Shannon,

The new blog-post folder with the date slug gets added upon creation inside the posts folder.

The workflow I would use:

  • create_post(title = "some_title", draft = TRUE) - some more details in the distill docs
  • Work on the blog post, test knitting, etc - the blogpost will not be written into the overall site structure until the draft option in the YAML is set to draft: false or draft is removed completely from the YAML
  • When you're ready to publish the post, update the date in the YAML header, change draft: false (or remove it) for the YAML and rename the folder to the date of publishing.

The URL date slug for the blogpost gets generated from the folder name, and the URL won't get "baked into" the overall site until draft is removed. So waiting to remove the draft component until the day of publishing and knitting should help your situation. You don't need to copy things over to a new folder, but just rename the folder in place.

2 Likes

Thanks! Just to make sure - when I'm ready to post and I have settled on my title and date, here is what I should do and the order?

  1. In YAML of .Rmd:
  • change title
  • change date
  1. Rename folder with new title and date

  2. Rename .Rmd with new title

  3. In YAML: change draft: false (or remove it)

Is this correct?

A couple more questions...

I did actually have draft: true on a folder name/date that I did not move forward with. This is no longer in the _posts folder, but it is lingering in _site\posts. How does that affect my site? Should I do something about it, or just don't worry about it?

Lastly, what is the importance of | in the description field of the YAML? What happens with or without it?
image

Thank you!!!

1 Like

Note that there's now a function for renaming the directory.

I am not sure the Rmd filename has any influence on the post URL.

I wouldn't worry about old drafts.

Regarding the pipe, it's a YAML thing, not a distill-specific thing. See e.g. https://yaml-multiline.info/ It's there to indicate the multiline content that's following. So I don't think one should remove it. That said, you could try and see what happens.

1 Like

Just adding two notes to my answer

  • I think distill questions should better be posted in the R Markdown category.

  • Keeping one question per thread (not counting follow-up questions related to the main question) makes it easier for folks to see your questions at a glance.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.