Skip to content

Commit

Permalink
Add default values for config variables (#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpotter2 authored Apr 23, 2020
1 parent 4a70853 commit b03fb73
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 30 deletions.
4 changes: 3 additions & 1 deletion _includes/footer-minimal.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<footer class="footer-min">
<div class="text-muted">
{% if site.author.name %}
{{ site.author.name }}
&nbsp;&nbsp;&bull;&nbsp;&nbsp;
{% endif %}
{% if page.date %}
{{ page.date }}
{% else %}
Expand All @@ -13,4 +15,4 @@
<a href="{{ '' | absolute_url }}">{{ site.url-pretty }}</a>
{% endif %}
</div>
</footer>
</footer>
2 changes: 2 additions & 0 deletions _includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
{%- endfor -%}
</ul>
<p class="copyright text-muted">
{% if site.author.name %}
{{ site.author.name }}
&nbsp;&bull;&nbsp;
{% endif %}
{{ site.time | date: '%Y' }}

{% if site.url-pretty %}
Expand Down
12 changes: 7 additions & 5 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
<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">

<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 }}" />

{% endif %}

{% if page.subtitle %}
<meta name="description" content="{{ page.subtitle }}">
{% 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 gtm_head.html %}
Expand Down Expand Up @@ -62,7 +64,7 @@
<meta property="og:title" content="{{ page.meta-title }}" />
{% elsif page.title %}
<meta property="og:title" content="{{ page.title }}" />
{% else %}
{% elsif site.title %}
<meta property="og:title" content="{{ site.title }}" />
{% endif %}

Expand Down
6 changes: 4 additions & 2 deletions _includes/header.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<!-- 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 %}
Expand Down Expand Up @@ -36,7 +38,7 @@ <h2 class="{{ include.type }}-subheading">{{ page.subtitle }}</h2>
{% endif %}

{% 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 %}
</div>
</div>
Expand All @@ -61,7 +63,7 @@ <h2 class="{{ include.type }}-subheading">{{ page.subtitle }}</h2>
{% endif %}

{% 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 %}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion _includes/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</button>
{%- if site.title-img -%}
<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>
{%- endif -%}
</div>
Expand Down
34 changes: 17 additions & 17 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ body {
font-size: 18px;
color: #404040;
position: relative;
background-color: {{ site.page-col }};
background-color: {{ site.page-col | default: "#FFFFFF" }};
{% if site.page-img %}
background-image: url({{ site.page-img | relative_url }});
background-attachment: fixed;
Expand All @@ -26,11 +26,11 @@ h1,h2,h3,h4,h5,h6 {
font-weight: 800;
}
a {
color: {{ site.link-col }};
color: {{ site.link-col | default: "#008AFF" }};
}
a:hover,
a:focus {
color: {{ site.hover-col }};
color: {{ site.hover-col | default: "#0085A1" }};
}
blockquote {
color: #808080;
Expand Down Expand Up @@ -68,12 +68,12 @@ hr.small {
::-moz-selection {
color: white;
text-shadow: none;
background-color: {{ site.hover-col }};
background-color: {{ site.hover-col | default: "#0085A1" }};
}
::selection {
color: white;
text-shadow: none;
background-color: {{ site.hover-col }};
background-color: {{ site.hover-col | default: "#0085A1" }};
}
img::selection {
color: white;
Expand Down Expand Up @@ -106,7 +106,7 @@ img {
/* --- Navbar --- */

.navbar-custom {
background-color: {{ site.navbar-col }};
background-color: {{ site.navbar-col | default: "#F5F5F5" }};
border-bottom: 1px solid #EAEAEA;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
{% if site.navbar-img %}
Expand All @@ -124,14 +124,14 @@ img {
.navbar-custom .navbar-brand,
.navbar-custom .nav li a {
font-weight: 800;
color: {{ site.navbar-text-col }};
color: {{ site.navbar-text-col | default: "#404040" }};
}

.navbar-custom .navbar-brand:hover,
.navbar-custom .navbar-brand:focus ,
.navbar-custom .nav li a:hover,
.navbar-custom .nav li a:focus {
color: {{ site.hover-col }};
color: {{ site.hover-col | default: "#0085A1" }};
}

.navbar-custom .navbar-brand-logo {
Expand Down Expand Up @@ -231,7 +231,7 @@ img {
display: block;
padding: 10px;
padding-left: 30px;
background-color: {{ site.navbar-children-col }};
background-color: {{ site.navbar-children-col | default: "#F5F5F5" }};
text-decoration: none !important;
border-width: 0 1px 1px 1px;
font-weight: normal;
Expand Down Expand Up @@ -271,19 +271,19 @@ footer {
border-top: 1px #EAEAEA solid;
margin-top: 50px;
font-size: 14px;
background-color: {{ site.footer-col }};
background-color: {{ site.footer-col | default: "#F5F5F5" }};
{% if site.footer-img %}
background-image: url({{ site.footer-img | relative_url }});
background-attachment: fixed;
{% endif %}
}

footer p.text-muted {
color: {{ site.footer-text-col }};
color: {{ site.footer-text-col | default: "#777777" }};
}

footer a {
color: {{site.footer-link-col}};
color: {{ site.footer-link-col | default: "#404040" }};
}

footer .list-inline {
Expand Down Expand Up @@ -337,7 +337,7 @@ footer .theme-by {
.post-preview a:focus,
.post-preview a:hover {
text-decoration: none;
color: {{ site.hover-col }};
color: {{ site.hover-col | default: "#0085A1" }};
}

.post-preview .post-title {
Expand Down Expand Up @@ -401,14 +401,14 @@ footer .theme-by {
}

.blog-tags a {
color: {{ site.link-col }};
color: {{ site.link-col | default: "#008AFF" }};
text-decoration: none;
padding: 0px 5px;
}

.blog-tags a:hover {
border-radius: 2px;
color: {{ site.hover-col }};
color: {{ site.hover-col | default: "#0085A1" }};
background-color: #EEE;
}

Expand Down Expand Up @@ -614,8 +614,8 @@ footer .theme-by {
.pager li a:hover,
.pager li a:focus {
color: #FFF;
border: 1px solid {{ site.hover-col }};
background-color: {{ site.hover-col }};
border: 1px solid {{ site.hover-col | default: "#0085A1" }};
background-color: {{ site.hover-col | default: "#0085A1" }};
}

.pager {
Expand Down
4 changes: 4 additions & 0 deletions feed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ layout: null
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
{% if site.title %}
<title>{{ site.title | xml_escape }}</title>
{% endif %}
{% if site.description %}
<description>{{ site.description | xml_escape }}</description>
{% endif %}
<link>{{ '' | absolute_url }}</link>
<atom:link href="{{ 'feed.xml' | absolute_url }}" rel="self" type="application/rss+xml" />
{% for post in site.posts limit:20 %}
Expand Down
8 changes: 5 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ <h3 class="post-subtitle">
</a>

<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>

<div class="post-entry-container">
Expand All @@ -31,9 +32,10 @@ <h3 class="post-subtitle">
</div>
{% endif %}
<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 %}
{% 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>
{% endif %}
</div>
Expand Down
4 changes: 3 additions & 1 deletion tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
title: 'Tag Index'
---

{% assign date_format = site.date_format | default: "%B %-d, %Y" %}

{%- capture site_tags -%}
{%- for tag in site.tags -%}
{{- tag | first -}}{%- unless forloop.last -%},{%- endunless -%}
Expand All @@ -25,7 +27,7 @@ <h2 id="{{- tag -}}" class="linked-section">
<div class="tag-entry">
<a href="{{ post.url | relative_url }}">{{- post.title -}}</a>
<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>
{%- endfor -%}
Expand Down

0 comments on commit b03fb73

Please sign in to comment.