Implement draft system

This commit is contained in:
n_u
2026-08-04 11:16:57 -05:00
parent 42cee91016
commit 6f5394010b
4 changed files with 21 additions and 2 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ layout: layouts/base.njk
<a href="{{ tagUrl }}">#{{ tag }}&nbsp;</a>
{%- endfor %}
</p>
<h1>{{ title | markdownify | safe}}</h1>
<h1>{% if draft %}<mark class="draftMarker">DRAFT:</mark> {% endif %}{{ title | markdownify | safe}}</h1>
{% if synopsis %}
<p class="post-synopsis">
{{ synopsis | markdownify | safe}}
+1 -1
View File
@@ -8,7 +8,7 @@
<a href="{{ post.url }}" class="postlist-link">
{% endif %}
<h3>
{% if post.data.title %}{{ post.data.title | markdownify | safe }}{% else %}?{% endif %}
{% if post.data.draft %}<mark class="draftMarker">DRAFT:</mark> {% endif %}{% if post.data.title %}{{ post.data.title | markdownify | safe }}{% else %}?{% endif %}
</h3>
{% if not postListTypeMicroblog %}
</a>
+8
View File
@@ -100,6 +100,14 @@ export default async function (eleventyConfig) {
return arr.slice(1, arr.length);
});
// Preprocessors
// Exclude drafts from full build
eleventyConfig.addPreprocessor("drafts", "*", (data, content) => {
if (data.draft && process.env.ELEVENTY_RUN_MODE === "build") {
return false;
}
});
// Transforms
eleventyConfig.addTransform("prettier", function (content, outputPath) {
if (outputPath && outputPath.endsWith(".html")) {
+11
View File
@@ -448,6 +448,17 @@ main > p > a > img {
width: 100%;
padding-top: var(--space-l);
}
mark {
color: var(--background-color);
&.draftMarker {
font-family: var(--font-family-metadata);
font-style: normal;
letter-spacing: var(--letter-spacing-metadata);
text-transform: var(--text-transform-metadata);
}
}
pre {
grid-column: var(--span-grid);
}