Implement draft system
This commit is contained in:
@@ -10,7 +10,7 @@ layout: layouts/base.njk
|
||||
<a href="{{ tagUrl }}">#{{ tag }} </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}}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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")) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user