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> <a href="{{ tagUrl }}">#{{ tag }}&nbsp;</a>
{%- endfor %} {%- endfor %}
</p> </p>
<h1>{{ title | markdownify | safe}}</h1> <h1>{% if draft %}<mark class="draftMarker">DRAFT:</mark> {% endif %}{{ title | markdownify | safe}}</h1>
{% if synopsis %} {% if synopsis %}
<p class="post-synopsis"> <p class="post-synopsis">
{{ synopsis | markdownify | safe}} {{ synopsis | markdownify | safe}}
+1 -1
View File
@@ -8,7 +8,7 @@
<a href="{{ post.url }}" class="postlist-link"> <a href="{{ post.url }}" class="postlist-link">
{% endif %} {% endif %}
<h3> <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> </h3>
{% if not postListTypeMicroblog %} {% if not postListTypeMicroblog %}
</a> </a>
+8
View File
@@ -100,6 +100,14 @@ export default async function (eleventyConfig) {
return arr.slice(1, arr.length); 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 // Transforms
eleventyConfig.addTransform("prettier", function (content, outputPath) { eleventyConfig.addTransform("prettier", function (content, outputPath) {
if (outputPath && outputPath.endsWith(".html")) { if (outputPath && outputPath.endsWith(".html")) {
+11
View File
@@ -448,6 +448,17 @@ main > p > a > img {
width: 100%; width: 100%;
padding-top: var(--space-l); 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 { pre {
grid-column: var(--span-grid); grid-column: var(--span-grid);
} }