From 2be76aa5fedf9d266daa152539b1f211d1943831 Mon Sep 17 00:00:00 2001 From: Philipp Flenker Date: Thu, 8 Aug 2019 08:51:01 +0200 Subject: [PATCH] feat: Allow empty titles in posts --- _layouts/default.html | 2 +- _pages/categories.md | 2 +- _posts/2019-08-08-no-title-posts.md | 6 ++++++ index.html | 12 ++++++------ search.json | 2 +- 5 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 _posts/2019-08-08-no-title-posts.md diff --git a/_layouts/default.html b/_layouts/default.html index 177647e..c5fa17f 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,7 +1,7 @@ - {% if page.title %}{{ page.title }} – {% endif %}{{ site.name }} – {{ site.description }} + {% if page.title and page.title != "" %}{{ page.title }} – {% endif %}{{ site.name }} – {{ site.description }} {% seo %} {% include meta.html %} diff --git a/_pages/categories.md b/_pages/categories.md index 8ce6bf2..eccf362 100644 --- a/_pages/categories.md +++ b/_pages/categories.md @@ -16,7 +16,7 @@ title: Categories {% for post in site.categories[category_name] %}
-

{{post.title}}

+

{% if post.title and post.title != "" %}{{post.title}}{% else %}{{post.excerpt |strip_html}}{%endif%}

{% endfor %} diff --git a/_posts/2019-08-08-no-title-posts.md b/_posts/2019-08-08-no-title-posts.md new file mode 100644 index 0000000..d14509e --- /dev/null +++ b/_posts/2019-08-08-no-title-posts.md @@ -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! \ No newline at end of file diff --git a/index.html b/index.html index 7623f72..7db56e9 100644 --- a/index.html +++ b/index.html @@ -5,13 +5,13 @@ layout: default
{% for post in paginator.posts %}
+ +

{{ post.title }}

-

{{ post.title }}

- -
- -
- +
+ +
+
{{ post.excerpt }}
diff --git a/search.json b/search.json index e129f5b..f0693ee 100644 --- a/search.json +++ b/search.json @@ -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" }}"