Skip to content

Commit 8d99467

Browse files
committed
update: feed.njk — exclude draft post
1 parent bd21fd4 commit 8d99467

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/feed.njk

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
}
1414
}
1515
---
16+
1617
<?xml version="1.0" encoding="utf-8"?>
1718
<?xml-stylesheet href="pretty-atom-feed.xsl" type="text/xsl"?>
1819
<feed xmlns="http://www.w3.org/2005/Atom" xml:base="{{ link.website }}">
@@ -29,16 +30,18 @@
2930
<email>{{ metadata.author.email }}</email>
3031
</author>
3132
{%- for post in collections.post | reverse %}
32-
{%- set absolutePostUrl = post.url | absoluteUrl(link.website) %}
33-
<entry>
34-
<title>{{ post.data.title }}</title>
35-
<link href="{{ absolutePostUrl }}" />
36-
<updated>{{ post.date | dateToRfc3339 }}</updated>
37-
<id>{{ absolutePostUrl }}</id>
38-
<content xml:lang="{{ metadata.language }}" type="html">
39-
{%- set templateContent = post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) %}
40-
{{ templateContent }}
41-
</content>
42-
</entry>
33+
{% if not post.data.draft %}
34+
{%- set absolutePostUrl = post.url | absoluteUrl(link.website) %}
35+
<entry>
36+
<title>{{ post.data.title }}</title>
37+
<link href="{{ absolutePostUrl }}" />
38+
<updated>{{ post.date | dateToRfc3339 }}</updated>
39+
<id>{{ absolutePostUrl }}</id>
40+
<content xml:lang="{{ metadata.language }}" type="html">
41+
{%- set templateContent = post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) %}
42+
{{ templateContent }}
43+
</content>
44+
</entry>
45+
{% endif %}
4346
{%- endfor %}
4447
</feed>

0 commit comments

Comments
 (0)