Skip to content

Commit

Permalink
fix: default template should test if date exists
Browse files Browse the repository at this point in the history
  • Loading branch information
clarete committed May 26, 2021
1 parent 11ec801 commit ffea6a9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
4 changes: 3 additions & 1 deletion themes/default/templates/feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
<link>{{ url_for("posts", slug=post.slug) }}</link>
<author>{{ post.author|default("author@mail.com (Blog Author)") }}</author>
<guid isPermaLink="false">{{ url_for("posts", slug=post.slug) }}</guid>
<pubDate>{{ post.date|strftime("%a, %d %b %Y %H:%M:%S %z") }}</pubDate>
{% if post.date is defined %}
<pubDate>{{ post.date|strftime("%a, %d %b %Y %H:%M:%S %z") }}</pubDate>
{% endif %}
<description><![CDATA[{{ post.html|safe }}]]></description>
</item>
{% endfor %}
Expand Down
28 changes: 15 additions & 13 deletions themes/default/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{% extends "base_layout.html" %} {% block main %}
<article class="post">
<h1 class="post-title">
<a href="">{{ post.title }}</a>
</h1>
<section class="post-meta">
{{ post.date }}
</section>
<section>
{{ post.html|safe }}
</section>
</article>
{% endblock %}
{% extends "base_layout.html" %} {% block main %}
<article class="post">
<h1 class="post-title">
<a href="">{{ post.title }}</a>
</h1>
<section class="post-meta">
{% if post.date is defined %}
{{ post.date|strftime("%b %d, %Y") }}
{% endif %}
</section>
<section>
{{ post.html|safe }}
</section>
</article>
{% endblock %}
4 changes: 3 additions & 1 deletion themes/default/templates/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ <h1 class="post__title">
{{ post.title }}
</h1>
<section class="post__meta">
{{ post.date|strftime("%b %d, %Y") }}
{% if post.date is defined %}
{{ post.date|strftime("%b %d, %Y") }}
{% endif %}
</section>
<section>
{{ post.html|safe }}
Expand Down

0 comments on commit ffea6a9

Please sign in to comment.