Skip to content

Commit

Permalink
Merge pull request #419 from sylhare/compress
Browse files Browse the repository at this point in the history
Compress HTML
  • Loading branch information
sylhare authored Dec 15, 2023
2 parents ec89a6d + df05271 commit 0b4900a
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 110 deletions.
57 changes: 57 additions & 0 deletions _includes/blog/post_footer.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{% assign color = include.color %}
{% assign img = include.img %}
{% capture _post_footer %}
<!-- To change color of links in the page -->
<style>
header#main {
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
{% if color != nil %}
.post-content a { color: {{ color }} !important; }
.share-buttons a { color: {{ color }} !important; }
.tag-list a:not(:hover) { color: {{ color }} !important; }
div#post-nav a { color: {{ color }} !important; }
footer a { color: {{ color }} !important; }
.site-header nav a:hover { color: {{ color }} !important; }
a.button:hover {
background: {{ color }} !important;
border: 1px solid {{ color }} !important;
color: white;
text-decoration: none;
filter: none;
}
header#main {
background-color: {{ color }} !important;
background-image: url('{{ site.color_image | relative_url }}');
}
{% endif %}
{% if img != nil %}
header#main { background-image: url('{{ img | relative_url }}'); }
{% endif %}
</style>

<!-- Post navigation -->
{% if site.post_navigation or site.theme_settings.post_navigation %}
{% include blog/post_nav.liquid %}
{% endif %}

<!--Utterances-->
{% if site.comments.utterances.repo and site.comments.utterances.issue-term %}
{% include social/utterances.liquid %}
{% endif %}

<!-- Cusdis -->
{% if site.comments.cusdis_app_id or site.cusdis_app_id %}
{% include social/cusdis.liquid %}
{% endif %}

<!-- Disqus -->
{% if site.comments.disqus_shortname or site.theme_settings.disqus_shortname or site.disqus_shortname %}
{% include social/disqus.liquid %}
{% endif %}
{% endcapture %}
{{ _post_footer | split: " " | join: " " }}
9 changes: 6 additions & 3 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
https://github.com/sylhare/Type-on-Strap/blob/master/LICENSE
-->
<html lang="en">
{% include default/head.liquid %}
{% capture _head %}{% include default/head.liquid %}{% endcapture %}
{{ _head | split: " " | join: " "}}
<body>
{% include default/navbar.liquid %}
{% capture _navbar %}{% include default/navbar.liquid %}{% endcapture %}
{{ _navbar | split: " " | join: " "}}
<div class="content">
{{ content }}
</div>
{% include default/footer.liquid %}
{% capture _footer %}{% include default/footer.liquid %}{% endcapture %}
{{ _footer | split: " " | join: " "}}
</body>
</html>
6 changes: 2 additions & 4 deletions _layouts/home.liquid
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
layout: default
---

<div class="home">
<style scoped>
{% assign image = site.header_feature_image | relative_url | split: '.' %}
Expand All @@ -24,7 +23,6 @@ layout: default
<div id="main" class="call-out call-out_img">
<h1> {{ site.header_text | default: "Change <code>header_text</code> in <code>_config.yml</code>"}} </h1>
</div>

{% include blog/blog.liquid %}

{% capture _blog %}{% include blog/blog.liquid %}{% endcapture %}
{{ _blog | split: " " | join: " "}}
</div>
53 changes: 24 additions & 29 deletions _layouts/page.liquid
Original file line number Diff line number Diff line change
@@ -1,35 +1,30 @@
---
layout: default
---

<article {% if page.feature-img %}class="feature-image"{% endif %}>

<header id="main" style="background-image: url('{{ page.feature-img | relative_url }}')">
<div class="title-padder">
{% if page.hide_title %}
<div class="feature-image-padding"></div>
{% else %}
<h1 id="{{ page.title | default: "" | cgi_escape }}" class="title"> {{ page.title }}</h1>
{% if page.subtitle %}
<h2 class="subtitle">{{ page.subtitle }}</h2>
<header id="main" style="background-image: url('{{ page.feature-img | relative_url }}')">
<div class="title-padder">
{% if page.hide_title %}
<div class="feature-image-padding"></div>
{% else %}
<h1 id="{{ page.title | default: "" | cgi_escape }}" class="title"> {{ page.title }}</h1>
{% if page.subtitle %}
<h2 class="subtitle">{{ page.subtitle }}</h2>
{% endif %}
{% endif %}
</div>
</header>
<section class="post-content">
{% if page.bootstrap %}
<div class="bootstrap-iso">
{% endif %}
{{ content }}
{% if page.bootstrap %}
</div>
{% endif %}
{% endif %}
</div>
</header>

<section class="post-content">
{% if page.bootstrap %}
<div class="bootstrap-iso">
{% endif %}
{{ content }}
{% if page.bootstrap %}
</div>
{% endif %}
</section>


<!-- Tag list for portfolio -->
{% capture tag_list %}{{ page.tags | join: "|"}}{% endcapture %}
{% include default/tags_list.liquid tags=tag_list %}

</section>
<!-- Tag list for portfolio -->
{% capture tag_list %}{{ page.tags | join: "|" }}{% endcapture %}
{% capture _tags %}{% include default/tags_list.liquid tags=tag_list %}{% endcapture %}
{{ _tags | split: " " | join: " " }}
</article>
98 changes: 24 additions & 74 deletions _layouts/post.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -2,80 +2,30 @@
layout: default
---
<article {% if page.feature-img or page.color %}class="feature-image" {% endif %}>
<header id="main" style="">
<div class="title-padder">
{% if page.hide_title %}
<div class="feature-image-padding"></div>
{% else %}
<h1 id="{{ page.title | cgi_escape }}" class="title">{{ page.title }}</h1>
{% include blog/post_info.liquid author=page.author date=page.date %}
{% endif %}
</div>
</header>

<section class="post-content">
{% if page.bootstrap %}
<div class="bootstrap-iso">
{% endif %}
{{ content }}
{% if page.bootstrap %}
</div>
{% endif %}
</section>

<!-- Social media shares -->
{% include social/share_buttons.liquid %}

<!-- Tag list -->
{% capture tag_list %}{{ page.tags | join: "|"}}{% endcapture %}
{% include default/tags_list.liquid tags=tag_list %}
<header id="main" style="">
<div class="title-padder">
{% if page.hide_title %}
<div class="feature-image-padding"></div>
{% else %}
<h1 id="{{ page.title | cgi_escape }}" class="title">{{ page.title }}</h1>
{% include blog/post_info.liquid author=page.author date=page.date %}
{% endif %}
</div>
</header>

<section class="post-content">
{% if page.bootstrap %}<div class="bootstrap-iso">{% endif %}
{{ content }}
{% if page.bootstrap %}</div>{% endif %}
</section>

<!-- Social media shares -->
{% include social/share_buttons.liquid %}

<!-- Tag list -->
{% capture tag_list %}{{ page.tags | join: "|" }}{% endcapture %}
{% include default/tags_list.liquid tags=tag_list %}

</article>

<!-- Post navigation -->
{% if site.post_navigation or site.theme_settings.post_navigation %}
{% include blog/post_nav.liquid %}
{% endif %}

<!--Utterances-->
{% if site.comments.utterances.repo and site.comments.utterances.issue-term %} {% include social/utterances.liquid %} {% endif %}

<!-- Cusdis -->
{% if site.comments.cusdis_app_id or site.cusdis_app_id %}{% include social/cusdis.liquid %}{% endif %}

<!-- Disqus -->
{% if site.comments.disqus_shortname or site.theme_settings.disqus_shortname or site.disqus_shortname %}
{% include social/disqus.liquid %}{% endif %}

<!-- To change color of links in the page -->
<style>
header#main {
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
{% if page.color %}
.post-content a { color: {{ page.color }} !important; }
.share-buttons a { color: {{ page.color }} !important; }
.tag-list a:not(:hover) { color: {{ page.color }} !important; }
div#post-nav a { color: {{ page.color }} !important; }
footer a { color: {{ page.color }} !important; }
.site-header nav a:hover { color: {{ page.color }} !important; }
a.button:hover {
background: {{ page.color }} !important;
border: 1px solid {{ page.color }} !important;
color: white;
text-decoration: none;
filter: none;
}
header#main {
background-color: {{ page.color }} !important;
background-image: url('{{ site.color_image | relative_url }}');
}
{% endif %}
{% if page.feature-img %}
header#main { background-image: url('{{ page.feature-img | relative_url }}'); }
{% endif %}
</style>
{% include blog/post_footer.liquid color=page.color img=page.feature-img %}

0 comments on commit 0b4900a

Please sign in to comment.