Skip to content

Commit

Permalink
Reduce layouts - use common parts with blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
dannystaple committed Jan 21, 2025
1 parent f631bf7 commit 363458f
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 65 deletions.
33 changes: 27 additions & 6 deletions _includes/layouts/common.liquid
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
---
theme:
name: orionrobots
---
{% comment %}{% capture BASE_PATH %}{% if eleventy.env.runMode == "serve" %}{% else %}{{ site.production_url }}{% endif %}{% endcapture %}{% endcomment %}
{% capture BASE_PATH %}{{ site.production_url }}{% endcapture %}
{% capture ASSET_PATH %}{{ BASE_PATH }}/assets/themes/{{ theme.name }}{% endcapture %}
Expand Down Expand Up @@ -59,8 +55,31 @@ theme:
{% include nav.liquid %}
<!-- Content -->
<div class="row">
{% block content %}{% endblock %}
{{ content }}
<div id="col-main" class="content {{ content_class }}">
<div class="gcse-searchresults"></div>
<nav class="row g-0 border rounded tag-row">
<div class="row g-0">
{% unless tags == empty %}
<nav>
{% assign tags_list = tags %}
{% include tags_list %}
</nav>
{% endunless %}
</div>
<div class="row g-0">{% include social-sharing %}</div>
</nav>
<h2 class="page-header">{{ title }} {% if tagline %}<small>{{tagline}}</small>{% endif %}</h2>
<div class="row-fluid post-full">
<div class="span12">
{% block post_info %}{% endblock %}
</div>
</div>
<article>
{% block content %}{% endblock %}
{{ content }}
</article>
</div>
{% block side_bar %}{% endblock %}
</div>
<footer id="bottom">
<div class="row" id="footer-left">
Expand Down Expand Up @@ -99,4 +118,6 @@ theme:
</script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
{% endif %}
{% block footer_scripts %}
{% endblock %}
</html>
33 changes: 11 additions & 22 deletions _includes/layouts/default.liquid
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
---
theme :
name : orionrobots
layout: common
---
<article id="col-main" class="content col-md-8">
<div class="gcse-searchresults"></div>
<nav class="row g-0 border rounded tag-row">
<div class="row g-0">
{% unless tags == empty %}
<nav>
{% assign tags_list = tags %}
{% include tags_list %}
</nav>
{% endunless %}
</div>
<div class="row g-0">{% include social-sharing %}</div>
</nav>
<h2 class="page-header">{{ title }} {% if tagline %}<small>{{tagline}}</small>{% endif %}</h2>
{{ content }}
{% assign content_class="col-md-8" %}

{% layout layouts/common %}

{% block content %}
{% if comments %}
{% include disqus_thread %}
{% endif %}
{% endblock %}

</article>
{% block side_bar %}
<aside class="col-md-4">
{% include sidebar-book.liquid %}
{% comment %}{% include sidebar_ads.liquid %}{% endcomment %}
</aside>
{% endblock %}

{% block footer_scripts %}
<script>
const newSlug = "{{ date | date: '%Y-%m-%d' }}-{{ slug }}";
document.addEventListener("DOMContentLoaded", function(event) {
document.addPostAdminButton(newSlug);
});
</script>
{% endblock %}
2 changes: 1 addition & 1 deletion _includes/layouts/gallery.liquid
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
layout: page
layout: default
---
{{ content }}
24 changes: 2 additions & 22 deletions _includes/layouts/index.liquid
Original file line number Diff line number Diff line change
@@ -1,22 +1,2 @@
---
theme :
name : orionrobots
layout: common
date: Last Modified
---
<article id="col-main" class="content col-md-12">
<div class="gcse-searchresults"></div>
<nav class="row g-0 border rounded tag-row">
<div class="row g-0">
{% unless tags == empty %}
<nav>
{% assign tags_list = tags %}
{% include tags_list %}
</nav>
{% endunless %}
</div>
<div class="row g-0">{% include social-sharing %}</div>
</nav>
<h2 class="page-header">{{ title }} {% if tagline %}<small>{{tagline}}</small>{% endif %}</h2>
{{ content }}
</article>
{% assign content_class="col-md-12" %}
{% layout layouts/common %}
20 changes: 6 additions & 14 deletions _includes/layouts/post.liquid
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
---
layout: default
---
<div class="row-fluid post-full">
<div class="span12">
<div class="date">
<time>{{ page.date | date_to_long_string }}</time>
<div class="author">by {{ page.author | default: author | default: "Danny Staple" }}</div>
</div>

<article class="content">
{{ content }}
</article>
</div>
{% layout layouts/default %}
{% block post_info %}
<div class="date text-secondary">
<time class="d-inline">{{ page.date | date_to_long_string }}</time>
<div class="author d-inline">by {{ page.author | default: author | default: "Danny Staple" }}</div>
</div>
{% endblock %}

0 comments on commit 363458f

Please sign in to comment.