Allow adding drafts

This commit is contained in:
arne 2022-02-20 18:33:48 +01:00
commit c7f0ba9fb4
2 changed files with 7 additions and 1 deletions

View file

@ -12,6 +12,10 @@ pnpm build
pnpm start # is the same as `pnpm watch` pnpm start # is the same as `pnpm watch`
``` ```
## Publishing
- Blog posts go into `src/posts`. The latest few are displayed on the home page. You can set `draft: true` in a post's front matter to render it without linking to it from somewhere else on the page.
## Build Environment ## Build Environment
The build environment is described in `flake.{nix,lock}` and `.envrc`. You can use [direnv](https://direnv.net/) and [nix with flakes support](https://nixos.org/) to automatically drop into a shell that contains all tools for building the website. The build environment is described in `flake.{nix,lock}` and `.envrc`. You can use [direnv](https://direnv.net/) and [nix with flakes support](https://nixos.org/) to automatically drop into a shell that contains all tools for building the website.

View file

@ -5,7 +5,9 @@
<h2>Recent Posts</h2> <h2>Recent Posts</h2>
<ul> <ul>
{%- for post in (collections.posts | reverse) -%} {%- for post in (collections.posts | reverse) -%}
<li{% if page.url == post.url %} aria-current="page"{% endif %}><time datetime="{{post.date}}">{{ post.date | toISODate }}</time> -- <a href="{{post.url}}">{{ post.data.title }}</a></li> {% if not post.data.draft %}
<li{% if page.url == post.url %} aria-current="page"{% endif %}><time datetime="{{post.date}}">{{ post.date | toISODate }}</time> -- <a href="{{post.url}}">{{ post.data.title }}</a></li>
{% endif %}
{%- endfor -%} {%- endfor -%}
</ul> </ul>
</nav> </nav>