Skip to content

Commit

Permalink
feat: Allow empty titles in posts
Browse files Browse the repository at this point in the history
  • Loading branch information
pflenker committed Aug 8, 2019
1 parent 0a2c28d commit 2be76aa
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion _layouts/default.html
Original file line number Diff line number Diff line change
@@ -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 %}

Expand Down
2 changes: 1 addition & 1 deletion _pages/categories.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 6 additions & 0 deletions _posts/2019-08-08-no-title-posts.md
Original file line number Diff line number Diff line change
@@ -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!
12 changes: 6 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<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>
Expand Down
2 changes: 1 addition & 1 deletion search.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}"
Expand Down

0 comments on commit 2be76aa

Please sign in to comment.