From cdf5c016bdeb16b8bc1ac0aa8de75b87e43f4223 Mon Sep 17 00:00:00 2001 From: Stephan Meijer Date: Thu, 16 Apr 2020 13:27:38 +0200 Subject: [PATCH] Also support nil By supporting nil in if-statements, you can completely remove the entries from yaml-metadata --- _includes/home-hero.html | 12 ++++++------ _includes/post-content.html | 2 +- _layouts/home.html | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/_includes/home-hero.html b/_includes/home-hero.html index 520d695d8..3f22747ce 100644 --- a/_includes/home-hero.html +++ b/_includes/home-hero.html @@ -8,13 +8,13 @@
- {% if site.title != '' %} + {% if site.title != empty and site.title != nil %}

{{site.title}}

{% endif %} - {% if site.description != '' or site.enable_contact == true %} + {% if site.description != empty and site.description != nil or site.enable_contact == true %}

- {% if site.description != '' %} + {% if site.description != empty and site.description != nil %} {{site.description}} {% endif %} @@ -27,13 +27,13 @@

{{site.title}}

- {% if site.twitter_username != '' %} + {% if site.twitter_username != empty and site.twitter_username != nil %} {% endif %} - {% if site.github_username != '' %} + {% if site.github_username != empty and site.github_username != nil %} {% endif %} - {% if site.medium_username != '' %} + {% if site.medium_username != empty and site.medium_username != nil %} {% endif %} diff --git a/_includes/post-content.html b/_includes/post-content.html index 48d60aa60..9156b3f83 100644 --- a/_includes/post-content.html +++ b/_includes/post-content.html @@ -3,7 +3,7 @@

{{ post.title }}

{{ post.lead_text }}

- {% if post.project_link != empty %} + {% if post.project_link != empty and project.link != nil %} {% endif %} diff --git a/_layouts/home.html b/_layouts/home.html index 9b4e9fbf1..cba2ab2cc 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -7,10 +7,10 @@
- {% if site.section_title != '' %} + {% if site.section_title != empty and site.section_title != nil %}

{{ site.section_title }}

{% endif %} - {% if site.section_subtitle != '' %} + {% if site.section_subtitle != empty and site.section_subtitle != nil %}

{{ site.section_subtitle }}

{% endif %}