Merge pull request #10 from pflenker/dev-no-title-posts
feat: Allow empty titles in posts
This commit is contained in:
commit
a8b8158dcb
|
@ -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 %}
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
index.html
12
index.html
|
@ -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>
|
||||
|
|
|
@ -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" }}"
|
||||
|
|
Loading…
Reference in New Issue