DRY up layouts by creating a default

This commit is contained in:
Michael Rose 2016-02-22 16:46:49 -05:00
parent 97b4571370
commit 7c1792312f
5 changed files with 118 additions and 241 deletions

47
_layouts/default.html Normal file
View file

@ -0,0 +1,47 @@
{% capture absurl %}{{ site.url }}{{ site.baseurl }}{% endcapture %}
<!DOCTYPE html>
<html lang="{{ site.locale | slice: 0,2 }}">
<head>
{% include head.html %}
</head>
<body class="{{ layout.class }}">
{% include browser-upgrade.html %}
{% include navigation.html %}
{% if page.image.feature %}
<div class="image-wrap">
<img src=
{% if page.image.feature contains 'http' %}
"{{ page.image.feature }}"
{% else %}
"{{ page.image.feature | prepend: "/images/" | prepend: absurl }}"
{% endif %}
alt="{{ page.title }} feature image">
{% if page.image.credit %}
<span class="image-credit">Photo Credit: <a href="{{ page.image.creditlink }}">{{ page.image.credit }}</a></span>
{% endif %}
</div><!-- /.image-wrap -->
{% endif %}
<div id="main" role="main">
<div class="article-author-side">
{% include author-bio.html %}
</div>
{{ content }}
</div><!-- /#main -->
<div class="footer-wrap">
<footer>
{% include footer.html %}
</footer>
</div><!-- /.footer-wrap -->
{% include scripts.html %}
</body>
</html>

View file

@ -1,61 +1,17 @@
{% capture absurl %}{{ site.url }}{{ site.baseurl }}{% endcapture %}
---
layout: default
---
<!doctype html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if (IE 7)&!(IEMobile)]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]-->
<!--[if (IE 8)&!(IEMobile)]><html class="no-js lt-ie9" lang="en"><![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"><!--<![endif]-->
<head>
{% include head.html %}
</head>
<body class="home">
{% include browser-upgrade.html %}
{% include navigation.html %}
{% if page.image.feature %}
<div class="image-wrap">
<img src=
{% if page.image.feature contains 'http' %}
"{{ page.image.feature }}"
<div id="index">
<h3><a href="{{ absurl }}/posts/">Recent Posts</a></h3>
{% for post in site.posts limit:5 %}
<article>
{% if post.link %}
<h2 class="link-post"><a href="{{ absurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a> <a href="{{ post.link }}" target="_blank" title="{{ post.title }}"><i class="fa fa-link"></i></a></h2>
{% else %}
"{{ page.image.feature | prepend: "/images/" | prepend: absurl }}"
<h2><a href="{{ absurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></h2>
<p>{{ post.excerpt | strip_html | truncate: 160 }}</p>
{% endif %}
alt="{{ page.title }} feature image">
{% if page.image.credit %}
<span class="image-credit">Photo Credit: <a href="{{ page.image.creditlink }}">{{ page.image.credit }}</a></span>
{% endif %}
</div><!-- /.image-wrap -->
{% endif %}
<div id="main" role="main">
<div class="article-author-side">
{% include author-bio.html %}
</div>
<div id="index">
<h3><a href="{{ absurl }}/posts/">Recent Posts</a></h3>
{% for post in site.posts limit:5 %}
<article>
{% if post.link %}
<h2 class="link-post"><a href="{{ absurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a> <a href="{{ post.link }}" target="_blank" title="{{ post.title }}"><i class="fa fa-link"></i></a></h2>
{% else %}
<h2><a href="{{ absurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></h2>
<p>{{ post.excerpt | strip_html | truncate: 160 }}</p>
{% endif %}
</article>
{% endfor %}
</div><!-- /#index -->
</div><!-- /#main -->
<div class="footer-wrap">
<footer>
{% include footer.html %}
</footer>
</div><!-- /.footer-wrap -->
{% include scripts.html %}
</body>
</html>
</article>
{% endfor %}
</div><!-- /#index -->

View file

@ -1,61 +1,21 @@
{% capture absurl %}{{ site.url }}{{ site.baseurl }}{% endcapture %}
---
layout: default
---
<!doctype html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if (IE 7)&!(IEMobile)]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]-->
<!--[if (IE 8)&!(IEMobile)]><html class="no-js lt-ie9" lang="en"><![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"><!--<![endif]-->
<head>
{% include head.html %}
</head>
<body class="page">
{% include browser-upgrade.html %}
{% include navigation.html %}
{% if page.image.feature %}
<div class="image-wrap">
<img src=
{% if page.image.feature contains 'http' %}
"{{ page.image.feature }}"
{% else %}
"{{ page.image.feature | prepend: "/images/" | prepend: absurl }}"
<article class="page">
<h1>{{ page.title }}</h1>
<div class="article-wrap">
{{ content }}
{% if page.share != false %}
<hr />
{% include social-share.html %}
{% endif %}
alt="{{ page.title }} feature image">
{% if page.image.credit %}
<span class="image-credit">Photo Credit: <a href="{{ page.image.creditlink }}">{{ page.image.credit }}</a></span>
</div><!-- /.article-wrap -->
{% if site.owner.disqus-shortname and page.comments == true %}
<section id="disqus_thread"></section><!-- /#disqus_thread -->
{% endif %}
</div><!-- /.image-wrap -->
{% endif %}
</article>
<div id="main" role="main">
<div class="article-author-side">
{% include author-bio.html %}
</div>
<article class="page">
<h1>{{ page.title }}</h1>
<div class="article-wrap">
{{ content }}
{% if page.share != false %}
<hr />
{% include social-share.html %}
{% endif %}
</div><!-- /.article-wrap -->
{% if site.owner.disqus-shortname and page.comments == true %}
<section id="disqus_thread"></section><!-- /#disqus_thread -->
{% endif %}
</article>
</div><!-- /#index -->
<div class="footer-wrap">
<footer>
{% include footer.html %}
</footer>
</div><!-- /.footer-wrap -->
{% include scripts.html %}
</body>
</html>
{% if site.owner.disqus-shortname and page.comments == true %}
<section id="disqus_thread"></section><!-- /#disqus_thread -->
{% endif %}

View file

@ -1,67 +1,23 @@
{% capture absurl %}{{ site.url }}{{ site.baseurl }}{% endcapture %}
---
layout: default
---
<!doctype html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if (IE 7)&!(IEMobile)]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]-->
<!--[if (IE 8)&!(IEMobile)]><html class="no-js lt-ie9" lang="en"><![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"><!--<![endif]-->
<head>
{% include head.html %}
</head>
<body class="post-index">
{% include browser-upgrade.html %}
{% include navigation.html %}
{% if page.image.feature %}
<div class="image-wrap">
<img src=
{% if page.image.feature contains 'http' %}
"{{ page.image.feature }}"
{% else %}
"{{ page.image.feature | prepend: "/images/" | prepend: absurl }}"
<div id="index">
<h1>{{ page.title }}</h1>
{% capture written_year %}'None'{% endcapture %}
{% for post in site.posts %}
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% if year != written_year %}
<h3>{{ year }}</h3>
{% capture written_year %}{{ year }}{% endcapture %}
{% endif %}
alt="{{ page.title }} feature image">
{% if page.image.credit %}
<span class="image-credit">Photo Credit: <a href="{{ page.image.creditlink }}">{{ page.image.credit }}</a></span>
{% endif %}
</div><!-- /.image-wrap -->
{% endif %}
<div id="main" role="main">
<div class="article-author-side">
{% include author-bio.html %}
</div>
<div id="index">
<h1>{{ page.title }}</h1>
{% capture written_year %}'None'{% endcapture %}
{% for post in site.posts %}
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% if year != written_year %}
<h3>{{ year }}</h3>
{% capture written_year %}{{ year }}{% endcapture %}
<article>
{% if post.link %}
<h2 class="link-post"><a href="{{ absurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a> <a href="{{ post.link }}" target="_blank" title="{{ post.title }}"><i class="fa fa-link"></i></a></h2>
{% else %}
<h2><a href="{{ absurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></h2>
<p>{{ post.excerpt | strip_html | truncate: 160 }}</p>
{% endif %}
<article>
{% if post.link %}
<h2 class="link-post"><a href="{{ absurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a> <a href="{{ post.link }}" target="_blank" title="{{ post.title }}"><i class="fa fa-link"></i></a></h2>
{% else %}
<h2><a href="{{ absurl }}{{ post.url }}" title="{{ post.title }}">{{ post.title }}</a></h2>
<p>{{ post.excerpt | strip_html | truncate: 160 }}</p>
{% endif %}
</article>
{% endfor %}
</div><!-- /#index -->
</div><!-- /#main -->
<div class="footer-wrap">
<footer>
{% include footer.html %}
</footer>
</div><!-- /.footer-wrap -->
{% include scripts.html %}
</body>
</html>
</article>
{% endfor %}
</div><!-- /#index -->

View file

@ -1,63 +1,30 @@
{% capture absurl %}{{ site.url }}{{ site.baseurl }}{% endcapture %}
---
layout: default
---
<!doctype html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if (IE 7)&!(IEMobile)]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]-->
<!--[if (IE 8)&!(IEMobile)]><html class="no-js lt-ie9" lang="en"><![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"><!--<![endif]-->
<head>
{% include head.html %}
</head>
<body class="post">
{% include browser-upgrade.html %}
{% include navigation.html %}
{% if page.image.feature %}
<div class="image-wrap">
<img src=
{% if page.image.feature contains 'http' %}
"{{ page.image.feature }}"
<article class="post">
<div class="headline-wrap">
{% if page.link %}
<h1><a href="{{ page.link }}">{{ page.title }}</a></h1>
{% else %}
"{{ page.image.feature | prepend: "/images/" | prepend: absurl }}"
<h1><a href="{{ absurl }}{{ page.url }}" rel="bookmark" title="{{ page.title }}">{{ page.title }}</a></h1>
{% endif %}
alt="{{ page.title }} feature image">
{% if page.image.credit %}
<span class="image-credit">Photo Credit: <a href="{{ page.image.creditlink }}">{{ page.image.credit }}</a></span>
{% endif %}
</div><!-- /.image-wrap -->
{% endif %}
</div><!--/ .headline-wrap -->
<div class="article-wrap">
{{ content }}
<hr />
<footer role="contentinfo">
{% if page.share != false %}{% include social-share.html %}{% endif %}
<p class="byline"><strong>{{ page.title }}</strong> was published on <time datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date: "%B %d, %Y" }}</time>{% if page.modified %} and last modified on <time datetime="{{ page.modified | date: "%Y-%m-%d" }}">{{ page.modified | date: "%B %d, %Y" }}</time>{% endif %}.</p>
</footer>
</div><!-- /.article-wrap -->
<div id="main" role="main">
<div class="article-author-side">
{% include author-bio.html %}
</div>
<article class="post">
<div class="headline-wrap">
{% if page.link %}
<h1><a href="{{ page.link }}">{{ page.title }}</a></h1>
{% else %}
<h1><a href="{{ absurl }}{{ page.url }}" rel="bookmark" title="{{ page.title }}">{{ page.title }}</a></h1>
{% endif %}
</div><!--/ .headline-wrap -->
<div class="article-wrap">
{{ content }}
<hr />
<footer role="contentinfo">
{% if page.share != false %}{% include social-share.html %}{% endif %}
<p class="byline"><strong>{{ page.title }}</strong> was published on <time datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date: "%B %d, %Y" }}</time>{% if page.modified %} and last modified on <time datetime="{{ page.modified | date: "%Y-%m-%d" }}">{{ page.modified | date: "%B %d, %Y" }}</time>{% endif %}.</p>
</footer>
</div><!-- /.article-wrap -->
{% if site.owner.disqus-shortname and page.comments == true %}
<section id="disqus_thread"></section><!-- /#disqus_thread -->
{% endif %}
</article>
</div><!-- /#main -->
</article>
<div class="footer-wrap">
{% if site.related_posts.size > 0 %}
{% if site.related_posts.size > 0 %}
<div class="related-articles">
<h4>You might also enjoy <small class="pull-right">(<a href="{{ absurl }}/posts/">View all posts</a>)</small></h4>
<ul>
@ -67,13 +34,4 @@
</ul>
<hr />
</div><!-- /.related-articles -->
{% endif %}
<footer>
{% include footer.html %}
</footer>
</div><!-- /.footer-wrap -->
{% include scripts.html %}
</body>
</html>
{% endif %}