Skip to content

Commit

Permalink
add support for draft blog posts
Browse files Browse the repository at this point in the history
  • Loading branch information
stebunovd committed Dec 7, 2024
1 parent 5b4ce43 commit 76bb87d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,34 @@ you have Hugo installed, clone the repo, and run:
$ hugo server
```

## HOWTO: Publish a draft blog post

Add the following two lines in the Frontmatter markup at the beginning of the
post:

```
sitemap:
disable: true
```

It'll hide the post from the [/blog/](https://ivelum.com/blog/) page and from
[sitemap.xml](https://ivelum.com/sitemap.xml), however you'll be able to preview it using the direct link. When
you're ready to publish the post, simply remove these lines.

Full example of the Frontmatter markup that marks a post as draft:

```
---
title: My new shiny post title (WIP)
description: Post description for SEO and sharing
date: 2024-12-08T12:00:00+0200
sitemap:
disable: true
---
In this episode, we'll talk about ...
```

## License

[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
2 changes: 1 addition & 1 deletion layouts/blog/blog.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- range .Pages.ByDate.Reverse }}
{{- range where .Pages.ByDate.Reverse "Params.sitemap.disable" "ne" true }}
<h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
<time datetime="{{ .Date | time.Format "2006-01-02" }}">
{{ .Date | time.Format ":date_medium" }}
Expand Down

0 comments on commit 76bb87d

Please sign in to comment.