feat: Allow empty titles in posts

This commit is contained in:
Philipp Flenker 2019-08-08 08:51:01 +02:00
parent 0a2c28d420
commit 2be76aa5fe
5 changed files with 15 additions and 9 deletions

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<title>{% if page.title %}{{ page.title }} {% endif %}{{ site.name }} {{ site.description }}</title>
<title>{% if page.title and page.title != "" %}{{ page.title }} {% endif %}{{ site.name }} {{ site.description }}</title>
{% seo %}
{% include meta.html %}

View File

@ -16,7 +16,7 @@ title: Categories
<a name="{{ category_name | slugize }}"></a>
{% for post in site.categories[category_name] %}
<article class="archive-item">
<h4><a href="{{ site.baseurl }}{{ post.url }}">{{post.title}}</a></h4>
<h4><a href="{{ site.baseurl }}{{ post.url }}">{% if post.title and post.title != "" %}{{post.title}}{% else %}{{post.excerpt |strip_html}}{%endif%}</a></h4>
</article>
{% endfor %}
</div>

View File

@ -0,0 +1,6 @@
---
layout: post
title: ""
categories: Miscellaneous
---
Sometimes, your post just stands for itself and doesn't need a title. And that's fine, too!

View File

@ -5,13 +5,13 @@ layout: default
<div class="posts">
{% for post in paginator.posts %}
<article class="post">
<a href="{{ site.baseurl }}{{ post.url }}">
<h1>{{ post.title }}</h1>
<h1><a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></h1>
<div>
<p class="post_date">{{ post.date | date: "%B %e, %Y" }}</p>
</div>
<div>
<p class="post_date">{{ post.date | date: "%B %e, %Y" }}</p>
</div>
</a>
<div class="entry">
{{ post.excerpt }}
</div>

View File

@ -4,7 +4,7 @@
{% for post in site.posts %}
{
"title" : "{{ post.title | escape }}",
"title" : "{% if post.title != "" %}{{ post.title | escape }}{% else %}{{ post.excerpt | strip_html | escape | strip }}{%endif%}",
"url" : "{{ site.baseurl }}{{ post.url }}",
"category" : "{{ post.categories | join: ', '}}",
"date" : "{{ post.date | date: "%B %e, %Y" }}"