From 7c1792312fef544f53537d8ac914f39bd8d12170 Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Mon, 22 Feb 2016 16:46:49 -0500 Subject: [PATCH] DRY up layouts by creating a default --- _layouts/default.html | 47 ++++++++++++++++++++++ _layouts/home.html | 72 +++++++--------------------------- _layouts/page.html | 74 ++++++++--------------------------- _layouts/post-index.html | 84 ++++++++++------------------------------ _layouts/post.html | 82 ++++++++++----------------------------- 5 files changed, 118 insertions(+), 241 deletions(-) create mode 100644 _layouts/default.html diff --git a/_layouts/default.html b/_layouts/default.html new file mode 100644 index 00000000..c063e621 --- /dev/null +++ b/_layouts/default.html @@ -0,0 +1,47 @@ +{% capture absurl %}{{ site.url }}{{ site.baseurl }}{% endcapture %} + + + + + +{% include head.html %} + + + + +{% include browser-upgrade.html %} + +{% include navigation.html %} + +{% if page.image.feature %} +
+ {{ page.title }} feature image + {% if page.image.credit %} + Photo Credit: {{ page.image.credit }} + {% endif %} +
+{% endif %} + +
+ + {{ content }} +
+ + + +{% include scripts.html %} + + + diff --git a/_layouts/home.html b/_layouts/home.html index a3d1931e..89dabf54 100644 --- a/_layouts/home.html +++ b/_layouts/home.html @@ -1,61 +1,17 @@ -{% capture absurl %}{{ site.url }}{{ site.baseurl }}{% endcapture %} +--- +layout: default +--- - - - - - - -{% include head.html %} - - - - -{% include browser-upgrade.html %} - -{% include navigation.html %} - -{% if page.image.feature %} -
- +

Recent Posts

+ {% for post in site.posts limit:5 %} +
+ {% if post.link %} +

{{ post.title }}

{% else %} - "{{ page.image.feature | prepend: "/images/" | prepend: absurl }}" +

{{ post.title }}

+

{{ post.excerpt | strip_html | truncate: 160 }}

{% endif %} - alt="{{ page.title }} feature image"> - {% if page.image.credit %} - Photo Credit: {{ page.image.credit }} - {% endif %} -
-{% endif %} - -
- -
-

Recent Posts

- {% for post in site.posts limit:5 %} - - {% endfor %} -
-
- - - -{% include scripts.html %} - - - + + {% endfor %} + \ No newline at end of file diff --git a/_layouts/page.html b/_layouts/page.html index 7c3aef64..773c94fb 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -1,61 +1,21 @@ -{% capture absurl %}{{ site.url }}{{ site.baseurl }}{% endcapture %} +--- +layout: default +--- - - - - - - -{% include head.html %} - - - - -{% include browser-upgrade.html %} - -{% include navigation.html %} - -{% if page.image.feature %} -
- +

{{ page.title }}

+
+ {{ content }} + {% if page.share != false %} +
+ {% include social-share.html %} {% endif %} - alt="{{ page.title }} feature image"> - {% if page.image.credit %} - Photo Credit: {{ page.image.credit }} +
+ {% if site.owner.disqus-shortname and page.comments == true %} +
{% endif %} -
-{% endif %} + -
- -
-

{{ page.title }}

-
- {{ content }} - {% if page.share != false %} -
- {% include social-share.html %} - {% endif %} -
- {% if site.owner.disqus-shortname and page.comments == true %} -
- {% endif %} -
-
- - - -{% include scripts.html %} - - - +{% if site.owner.disqus-shortname and page.comments == true %} +
+{% endif %} \ No newline at end of file diff --git a/_layouts/post-index.html b/_layouts/post-index.html index 86bbe6d7..5e0a1721 100644 --- a/_layouts/post-index.html +++ b/_layouts/post-index.html @@ -1,67 +1,23 @@ -{% capture absurl %}{{ site.url }}{{ site.baseurl }}{% endcapture %} +--- +layout: default +--- - - - - - - -{% include head.html %} - - - - -{% include browser-upgrade.html %} - -{% include navigation.html %} - -{% if page.image.feature %} -
- +

{{ page.title }}

+ {% capture written_year %}'None'{% endcapture %} + {% for post in site.posts %} + {% capture year %}{{ post.date | date: '%Y' }}{% endcapture %} + {% if year != written_year %} +

{{ year }}

+ {% capture written_year %}{{ year }}{% endcapture %} {% endif %} - alt="{{ page.title }} feature image"> - {% if page.image.credit %} - Photo Credit: {{ page.image.credit }} - {% endif %} -
-{% endif %} - -
- -
-

{{ page.title }}

- {% capture written_year %}'None'{% endcapture %} - {% for post in site.posts %} - {% capture year %}{{ post.date | date: '%Y' }}{% endcapture %} - {% if year != written_year %} -

{{ year }}

- {% capture written_year %}{{ year }}{% endcapture %} +
-
- - - -{% include scripts.html %} - - - + + {% endfor %} + \ No newline at end of file diff --git a/_layouts/post.html b/_layouts/post.html index 21df37f6..7c95e891 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -1,63 +1,30 @@ -{% capture absurl %}{{ site.url }}{{ site.baseurl }}{% endcapture %} +--- +layout: default +--- - - - - - - -{% include head.html %} - - - - -{% include browser-upgrade.html %} - -{% include navigation.html %} - -{% if page.image.feature %} -
- +
+ {% if page.link %} +

{{ page.title }}

{% else %} - "{{ page.image.feature | prepend: "/images/" | prepend: absurl }}" +

{{ page.title }}

{% endif %} - alt="{{ page.title }} feature image"> - {% if page.image.credit %} - Photo Credit: {{ page.image.credit }} - {% endif %} -
-{% endif %} +
+
+ {{ content }} +
+
+ {% if page.share != false %}{% include social-share.html %}{% endif %} + +
+
-
- -
-
- {% if page.link %} -

{{ page.title }}

- {% else %} -

{{ page.title }}

- {% endif %} -
-
- {{ content }} -
-
- {% if page.share != false %}{% include social-share.html %}{% endif %} - -
-
{% if site.owner.disqus-shortname and page.comments == true %}
{% endif %} -
-
+ - - -{% include scripts.html %} - - - +{% endif %} \ No newline at end of file