Add default values for config variables (#621)

This commit is contained in:
Gabriel 2020-04-24 01:18:23 +02:00 committed by GitHub
parent 4a708530d9
commit b03fb7311f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 46 additions and 30 deletions

View File

@ -1,7 +1,9 @@
<footer class="footer-min"> <footer class="footer-min">
<div class="text-muted"> <div class="text-muted">
{% if site.author.name %}
{{ site.author.name }} {{ site.author.name }}
&nbsp;&nbsp;&bull;&nbsp;&nbsp; &nbsp;&nbsp;&bull;&nbsp;&nbsp;
{% endif %}
{% if page.date %} {% if page.date %}
{{ page.date }} {{ page.date }}
{% else %} {% else %}

View File

@ -25,8 +25,10 @@
{%- endfor -%} {%- endfor -%}
</ul> </ul>
<p class="copyright text-muted"> <p class="copyright text-muted">
{% if site.author.name %}
{{ site.author.name }} {{ site.author.name }}
&nbsp;&bull;&nbsp; &nbsp;&bull;&nbsp;
{% endif %}
{{ site.time | date: '%Y' }} {{ site.time | date: '%Y' }}
{% if site.url-pretty %} {% if site.url-pretty %}

View File

@ -3,15 +3,17 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, viewport-fit=cover"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, viewport-fit=cover">
<title>{% if page.use-site-title %}{{ site.title }} {{ site.title-separator }} {{ site.description }}{% elsif page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}</title> <title>{% if page.use-site-title %}{{ site.title }} {{ site.title-separator | default: '-' }} {{ site.description }}{% elsif page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}</title>
{% if site.author.name %}
<meta name="author" content="{{ site.author.name }}" /> <meta name="author" content="{{ site.author.name }}" />
{% endif %}
{% if page.subtitle %} {% if page.subtitle %}
<meta name="description" content="{{ page.subtitle }}"> <meta name="description" content="{{ page.subtitle }}">
{% endif %} {% endif %}
<link rel="alternate" type="application/rss+xml" title="{{ site.title }} {{ site.title-separator }} {{ site.description }}" href="{{ '/feed.xml' | absolute_url }}" /> <link rel="alternate" type="application/rss+xml" title="{{ site.title | default: 'Untitled' }} {{ site.title-separator | default: '-' }} {{ site.description }}" href="{{ '/feed.xml' | absolute_url }}" />
{% include gtag.html %} {% include gtag.html %}
{% include gtm_head.html %} {% include gtm_head.html %}
@ -62,7 +64,7 @@
<meta property="og:title" content="{{ page.meta-title }}" /> <meta property="og:title" content="{{ page.meta-title }}" />
{% elsif page.title %} {% elsif page.title %}
<meta property="og:title" content="{{ page.title }}" /> <meta property="og:title" content="{{ page.title }}" />
{% else %} {% elsif site.title %}
<meta property="og:title" content="{{ site.title }}" /> <meta property="og:title" content="{{ site.title }}" />
{% endif %} {% endif %}

View File

@ -1,5 +1,7 @@
<!-- TODO this file has become a mess, refactor it --> <!-- TODO this file has become a mess, refactor it -->
{% assign date_format = site.date_format | default: "%B %-d, %Y" %}
{% if page.bigimg or page.title %} {% if page.bigimg or page.title %}
{% if page.bigimg %} {% if page.bigimg %}
@ -36,7 +38,7 @@
{% endif %} {% endif %}
{% if include.type == "post" %} {% if include.type == "post" %}
<span class="post-meta">Posted on {{ page.date | date: site.date_format }}</span> <span class="post-meta">Posted on {{ page.date | date: date_format }}</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>
@ -61,7 +63,7 @@
{% endif %} {% endif %}
{% if include.type == "post" %} {% if include.type == "post" %}
<span class="post-meta">Posted on {{ page.date | date: site.date_format }}</span> <span class="post-meta">Posted on {{ page.date | date: date_format }}</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@ -9,7 +9,7 @@
</button> </button>
{%- if site.title-img -%} {%- if site.title-img -%}
<a class="navbar-brand navbar-brand-logo" href="{{ '' | absolute_url }}"><img src="{{ site.title-img }}"/></a> <a class="navbar-brand navbar-brand-logo" href="{{ '' | absolute_url }}"><img src="{{ site.title-img }}"/></a>
{%- else -%} {%- elsif site.title -%}
<a class="navbar-brand" href="{{ '' | absolute_url }}">{{ site.title }}</a> <a class="navbar-brand" href="{{ '' | absolute_url }}">{{ site.title }}</a>
{%- endif -%} {%- endif -%}
</div> </div>

View File

@ -11,7 +11,7 @@ body {
font-size: 18px; font-size: 18px;
color: #404040; color: #404040;
position: relative; position: relative;
background-color: {{ site.page-col }}; background-color: {{ site.page-col | default: "#FFFFFF" }};
{% if site.page-img %} {% if site.page-img %}
background-image: url({{ site.page-img | relative_url }}); background-image: url({{ site.page-img | relative_url }});
background-attachment: fixed; background-attachment: fixed;
@ -26,11 +26,11 @@ h1,h2,h3,h4,h5,h6 {
font-weight: 800; font-weight: 800;
} }
a { a {
color: {{ site.link-col }}; color: {{ site.link-col | default: "#008AFF" }};
} }
a:hover, a:hover,
a:focus { a:focus {
color: {{ site.hover-col }}; color: {{ site.hover-col | default: "#0085A1" }};
} }
blockquote { blockquote {
color: #808080; color: #808080;
@ -68,12 +68,12 @@ hr.small {
::-moz-selection { ::-moz-selection {
color: white; color: white;
text-shadow: none; text-shadow: none;
background-color: {{ site.hover-col }}; background-color: {{ site.hover-col | default: "#0085A1" }};
} }
::selection { ::selection {
color: white; color: white;
text-shadow: none; text-shadow: none;
background-color: {{ site.hover-col }}; background-color: {{ site.hover-col | default: "#0085A1" }};
} }
img::selection { img::selection {
color: white; color: white;
@ -106,7 +106,7 @@ img {
/* --- Navbar --- */ /* --- Navbar --- */
.navbar-custom { .navbar-custom {
background-color: {{ site.navbar-col }}; background-color: {{ site.navbar-col | default: "#F5F5F5" }};
border-bottom: 1px solid #EAEAEA; border-bottom: 1px solid #EAEAEA;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
{% if site.navbar-img %} {% if site.navbar-img %}
@ -124,14 +124,14 @@ img {
.navbar-custom .navbar-brand, .navbar-custom .navbar-brand,
.navbar-custom .nav li a { .navbar-custom .nav li a {
font-weight: 800; font-weight: 800;
color: {{ site.navbar-text-col }}; color: {{ site.navbar-text-col | default: "#404040" }};
} }
.navbar-custom .navbar-brand:hover, .navbar-custom .navbar-brand:hover,
.navbar-custom .navbar-brand:focus , .navbar-custom .navbar-brand:focus ,
.navbar-custom .nav li a:hover, .navbar-custom .nav li a:hover,
.navbar-custom .nav li a:focus { .navbar-custom .nav li a:focus {
color: {{ site.hover-col }}; color: {{ site.hover-col | default: "#0085A1" }};
} }
.navbar-custom .navbar-brand-logo { .navbar-custom .navbar-brand-logo {
@ -231,7 +231,7 @@ img {
display: block; display: block;
padding: 10px; padding: 10px;
padding-left: 30px; padding-left: 30px;
background-color: {{ site.navbar-children-col }}; background-color: {{ site.navbar-children-col | default: "#F5F5F5" }};
text-decoration: none !important; text-decoration: none !important;
border-width: 0 1px 1px 1px; border-width: 0 1px 1px 1px;
font-weight: normal; font-weight: normal;
@ -271,7 +271,7 @@ footer {
border-top: 1px #EAEAEA solid; border-top: 1px #EAEAEA solid;
margin-top: 50px; margin-top: 50px;
font-size: 14px; font-size: 14px;
background-color: {{ site.footer-col }}; background-color: {{ site.footer-col | default: "#F5F5F5" }};
{% if site.footer-img %} {% if site.footer-img %}
background-image: url({{ site.footer-img | relative_url }}); background-image: url({{ site.footer-img | relative_url }});
background-attachment: fixed; background-attachment: fixed;
@ -279,11 +279,11 @@ footer {
} }
footer p.text-muted { footer p.text-muted {
color: {{ site.footer-text-col }}; color: {{ site.footer-text-col | default: "#777777" }};
} }
footer a { footer a {
color: {{site.footer-link-col}}; color: {{ site.footer-link-col | default: "#404040" }};
} }
footer .list-inline { footer .list-inline {
@ -337,7 +337,7 @@ footer .theme-by {
.post-preview a:focus, .post-preview a:focus,
.post-preview a:hover { .post-preview a:hover {
text-decoration: none; text-decoration: none;
color: {{ site.hover-col }}; color: {{ site.hover-col | default: "#0085A1" }};
} }
.post-preview .post-title { .post-preview .post-title {
@ -401,14 +401,14 @@ footer .theme-by {
} }
.blog-tags a { .blog-tags a {
color: {{ site.link-col }}; color: {{ site.link-col | default: "#008AFF" }};
text-decoration: none; text-decoration: none;
padding: 0px 5px; padding: 0px 5px;
} }
.blog-tags a:hover { .blog-tags a:hover {
border-radius: 2px; border-radius: 2px;
color: {{ site.hover-col }}; color: {{ site.hover-col | default: "#0085A1" }};
background-color: #EEE; background-color: #EEE;
} }
@ -614,8 +614,8 @@ footer .theme-by {
.pager li a:hover, .pager li a:hover,
.pager li a:focus { .pager li a:focus {
color: #FFF; color: #FFF;
border: 1px solid {{ site.hover-col }}; border: 1px solid {{ site.hover-col | default: "#0085A1" }};
background-color: {{ site.hover-col }}; background-color: {{ site.hover-col | default: "#0085A1" }};
} }
.pager { .pager {

View File

@ -4,8 +4,12 @@ layout: null
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel> <channel>
{% if site.title %}
<title>{{ site.title | xml_escape }}</title> <title>{{ site.title | xml_escape }}</title>
{% endif %}
{% if site.description %}
<description>{{ site.description | xml_escape }}</description> <description>{{ site.description | xml_escape }}</description>
{% endif %}
<link>{{ '' | absolute_url }}</link> <link>{{ '' | absolute_url }}</link>
<atom:link href="{{ 'feed.xml' | absolute_url }}" rel="self" type="application/rss+xml" /> <atom:link href="{{ 'feed.xml' | absolute_url }}" rel="self" type="application/rss+xml" />
{% for post in site.posts limit:20 %} {% for post in site.posts limit:20 %}

View File

@ -19,7 +19,8 @@ use-site-title: true
</a> </a>
<p class="post-meta"> <p class="post-meta">
Posted on {{ post.date | date: site.date_format }} {% assign date_format = site.date_format | default: "%B %-d, %Y" %}
Posted on {{ post.date | date: date_format }}
</p> </p>
<div class="post-entry-container"> <div class="post-entry-container">
@ -31,9 +32,10 @@ use-site-title: true
</div> </div>
{% endif %} {% endif %}
<div class="post-entry"> <div class="post-entry">
{{ post.excerpt | strip_html | xml_escape | truncatewords: site.excerpt_length }} {% assign excerpt_length = site.excerpt_length | default: 50 %}
{{ post.excerpt | strip_html | xml_escape | truncatewords: excerpt_length }}
{% assign excerpt_word_count = post.excerpt | number_of_words %} {% assign excerpt_word_count = post.excerpt | number_of_words %}
{% if post.content != post.excerpt or excerpt_word_count > site.excerpt_length %} {% if post.content != post.excerpt or excerpt_word_count > excerpt_length %}
<a href="{{ post.url | relative_url }}" class="post-read-more">[Read&nbsp;More]</a> <a href="{{ post.url | relative_url }}" class="post-read-more">[Read&nbsp;More]</a>
{% endif %} {% endif %}
</div> </div>

View File

@ -3,6 +3,8 @@ layout: page
title: 'Tag Index' title: 'Tag Index'
--- ---
{% assign date_format = site.date_format | default: "%B %-d, %Y" %}
{%- capture site_tags -%} {%- capture site_tags -%}
{%- for tag in site.tags -%} {%- for tag in site.tags -%}
{{- tag | first -}}{%- unless forloop.last -%},{%- endunless -%} {{- tag | first -}}{%- unless forloop.last -%},{%- endunless -%}
@ -25,7 +27,7 @@ title: 'Tag Index'
<div class="tag-entry"> <div class="tag-entry">
<a href="{{ post.url | relative_url }}">{{- post.title -}}</a> <a href="{{ post.url | relative_url }}">{{- post.title -}}</a>
<div class="entry-date"> <div class="entry-date">
<time datetime="{{- post.date | date_to_xmlschema -}}">{{- post.date | date: site.date_format -}}</time> <time datetime="{{- post.date | date_to_xmlschema -}}">{{- post.date | date: date_format -}}</time>
</div> </div>
</div> </div>
{%- endfor -%} {%- endfor -%}