Jekyll has the concept of future posts, but I do not think that is what you are looking to use.
Jekyll also has the concept of drafts, so you can put a post in the root _drafts
folder and then move it to the _posts
folder when ready. However, I wouldn’t say I like using that feature because it takes more steps to name the file when ready, and you have to move the post from one folder to another physically.
Preferred method: New YAML tag
My preferred option is to use the standard _posts
folder and add a new line of custom YML, like this:
/posts/2022-05-24-my-post.md
---
title: My post
date: 2022-05-24
layout: post
isPublic: false
---
Here is the text for this unfinished post
Note how I added isPublic: false
. That means you can write custom code to display (or not display) the post. Of course, you can type isPublic: true
for any posts that should have links.
Display the post without a link
The following code will display all the posts, but not provide a link if isPublic: false
. I added the [unfinished work]
text at the beginning just so the reader knows there is not a link yet:
{%- assign posts = site.posts -%}
{%- for post in posts -%}
{%- if post.isPublic -%}
<a href="{{ post.url | relative_url }}">
{{ post.title | escape }}
</a>
{%- else -%}
[unfinished work] {{ post.title | escape }}
{%- endif -%}
<p>
{%- endfor -%}
Do not display unfinished links
If you do not want to display the post at all, you can use the following code:
{%- assign posts = site.posts | where_exp: "post", "post.isPublic" -%}
{%- for post in posts -%}
<a href="{{ post.url | relative_url }}">
{{ post.title | escape }}
</a>
{%- endfor -%}
Considerations
Drafts and future posts
I mentioned that draft
and future
posts might be an option to look into, so here are the direct links just in case you want to read up on them.
To learn more about draft posts, check out this link:
To learn more about future posts, check out this link:
Collections (for awareness)
Since you are building a wiki, you might find that you want to categorize and manage these posts in folders. That method is helpful if there are primary categories of content and you have a considerable amount of content (think hundreds or thousands of posts over a few dozen posts). While collections will still require code, as I shared above, I thought you might be interested in this feature.
To read about collections, check out this link: