Skip to content

Commit e261b38

Browse files
committed
Try caching includes
1 parent b86f565 commit e261b38

20 files changed

Lines changed: 29 additions & 31 deletions

‎Gemfile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ group :jekyll_plugins do
2020
gem "jekyll-sitemap", "~> 1.4.0"
2121
gem "jekyll-seo-tag", github: "buddhist-uni/jekyll-seo-tag", branch: 'obu-custom-seo'
2222
gem "jekyll-last-modified-at", github: "buddhist-uni/jekyll-last-modified-at", branch: 'post-date'
23+
gem 'jekyll-include-cache'
2324
end
2425

2526
# For my own ruby code

‎Gemfile.lock‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ GEM
5454
rouge (~> 3.0)
5555
safe_yaml (~> 1.0)
5656
terminal-table (~> 2.0)
57+
jekyll-include-cache (0.2.1)
58+
jekyll (>= 3.7, < 5.0)
5759
jekyll-sass-converter (2.2.0)
5860
sassc (> 2.0.1, < 3.0)
5961
jekyll-sitemap (1.4.0)
@@ -93,6 +95,7 @@ PLATFORMS
9395
DEPENDENCIES
9496
jekyll (~> 4.2.0)
9597
jekyll-feed!
98+
jekyll-include-cache
9699
jekyll-last-modified-at!
97100
jekyll-seo-tag!
98101
jekyll-sitemap (~> 1.4.0)

‎_config.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ markdown: kramdown
3434
plugins:
3535
- jekyll-feed
3636
- jekyll-sitemap
37+
- jekyll-include-cache
3738
- jekyll-last-modified-at
3839
last-modified-at:
3940
use-git-cache: true

‎_includes/content-category-row.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<tr>
22
{% assign catcon = site.content | where: "category", include.category %}
33
{% assign category = site.categories | find: "slug", include.category %}
4-
<td>{% include content_icon.html category=include.category %} <a href="{{ category.url }}">{{ category.title }}</a>
4+
<td>{% include_cached content_icon.html category=include.category %} <a href="{{ category.url }}">{{ category.title }}</a>
55
{% if category.subcats %}<ul>{% for subcat in category.subcats %}
6-
<li style="list-style:none;">{% include content_icon.html category=include.category subcat=subcat %} <a href="/search/?q=%2Bis%3A{{ subcat }}">{{ subcat }}</a> ({{ catcon | where: "subcat", subcat | size }})</li>
6+
<li style="list-style:none;">{% include_cached content_icon.html category=include.category subcat=subcat %} <a href="/search/?q=%2Bis%3A{{ subcat }}">{{ subcat }}</a> ({{ catcon | where: "subcat", subcat | size }})</li>
77
{% endfor %}</ul>{% endif %}
88
</td>
99
<td markdown="span">{{ catcon | size }} {% if include.category == "av" %}<br />(&#62;{{ catcon | map: "minutes" | sum | divided_by: 60 }} hours!){% endif %}</td>

‎_includes/content_filelinks.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
{%- endif -%}
3030
{%- if showworldcat -%}
3131
{%- unless include.content.excerpt_url -%}<details class="copyright details-reset"><summary>{%- endunless -%}
32-
{%- capture authors -%}{% include content_authors_string.html content=include.content %}{%- endcapture -%}
32+
{%- capture authors -%}{% include_cached content_authors_string.html content=include.content %}{%- endcapture -%}
3333
{% assign authors = authors | strip_html | strip | cgi_escape %}
3434
<a class="btn" href="https://www.worldcat.org/{% if include.content.oclc %}oclc/{{ include.content.oclc }}{% else %}search?q=ti%3A{{ include.content.title | markdownify | strip_html | strip | cgi_escape }}{% if authors %}+au%3A{{ authors }}{% endif %}{% if include.content.category == 'monographs' %}&fq=x0%3Abook+%3E+ln%3Aeng{% endif %}&qt=advanced{% endif %}"><i class="fas fa-binoculars"></i> WorldCat&trade;</a>
3535
<i class="far fa-question-circle"></i>

‎_includes/content_list.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
{% endif %}
1212
{%- for c in sorted -%}
1313
{%- if c.status == 'featured' -%}
14-
{% include highlighted_content.html content=c %}
14+
{% include_cached highlighted_content.html content=c %}
1515
{%- else -%}
16-
{% include simple_content.html content=c %}
16+
{% include_cached simple_content.html content=c %}
1717
{%- endif -%}
1818
{%- endfor -%}

‎_includes/content_title.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% assign c = include.content %}{% assign category = c.path | split: '/' %}{% assign category = category[1] %}
22
{% assign value = c.base_value %}{% if c.status == "featured" %}{% assign value = value | times: site.data.ga.featured_value_multiplier %}{% endif %}
3-
{% include content_icon.html category=category subcat=c.subcat %}
3+
{% include_cached content_icon.html category=category subcat=c.subcat %}
44
{% include content_path.liquid content=c %}
5-
<span id="{{ c.slug }}" class="inline_content_title">{% if c.external_url %}<a target="_blank" data-content-path="{{ content_path }}" ga-event-value="{{ value }}" href="{{ c.external_url }}">{% endif %}{{ c.title | markdownify | remove: '<p>' | remove: '</p>' }}{% if c.authors.size > 0 or c.reader %} – {% include content_authors_string.html content=c %}{% endif %}{% if c.external_url %}</a>{% endif %}</span>
5+
<span id="{{ c.slug }}" class="inline_content_title">{% if c.external_url %}<a target="_blank" data-content-path="{{ content_path }}" ga-event-value="{{ value }}" href="{{ c.external_url }}">{% endif %}{{ c.title | markdownify | remove: '<p>' | remove: '</p>' }}{% if c.authors.size > 0 or c.reader %} – {% include_cached content_authors_string.html content=c %}{% endif %}{% if c.external_url %}</a>{% endif %}</span>
66
{% if c.drive_links %}<span class="inline_drive_links">{% for link in c.file_links %}<span class="inline_drive_link"> (<a target="_blank" ga-event-value="{{ value }}" ga-event-label="{{ link }}" data-content-path="{{ content_path }}" href="{{ site.data.content.filehost | append: link }}"><i class="fa{% case c.formats[forloop.index0] %}{% when "pdf" %}r fa-file-pdf{% when "mp3" %}r fa-file-audio{% when "m4a" %}r fa-file-audio{% when "epub" %}s fa-tablet-alt{% when "png" %}r fa-file-image{% when "mp3s" %}r fa-file-open{% when "zip" %}r fa-file-archive{% when "pdfs" %}r fa-file-open{% when "wma" %}r fa-file-audio{% else %}r fa-file{% endcase %}"></i>.{{ c.formats[forloop.index0] }}</a>)</span>{% endfor %}{% for link in c.drive_links %}{% assign index = forloop.index | minus: 1 %}<span class="inline_drive_link"> (<a target="_blank" ga-event-value="{{ value }}" ga-event-label="drive.google.com/{{ content_path }}.{{ c.formats[index] }}" data-content-path="{{ content_path }}" href="{{ link }}"><i class="fa{% if link contains "drive.google.com" %}b fa-google-drive{% else %}s fa-globe{% endif %}"></i>.{{ c.formats[index] }}</a>)</span>{% endfor %}</span>{% endif %}

‎_includes/featured_content_list.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{% for c in sorted %}
99
<li>
1010
{% if c.olid %}<div class="ol-cover"><a href="{{ c.url }}">{{ c.title | markdownify | strip_html }}<img src="http://covers.openlibrary.org/b/olid/{{ c.olid }}-L.jpg" alt="{{ c.title }}"></a></div>{% else %}
11-
<div class="content_title">{% capture foo %}{% include simple_content_title.html content=c %}{% endcapture %}{{ foo | strip_newlines }}</div>{% endif %}
11+
<div class="content_title">{% capture foo %}{% include_cached simple_content_title.html content=c %}{% endcapture %}{{ foo | strip_newlines }}</div>{% endif %}
1212
<div class="star_label">{% include calculatestars.dat content=c %}{% unless stars == 3 %}<span class="RatingLabel-{{ stars }}">{% include starlabel.html stars=stars %}</span>{% endunless %}</div>
1313
{% unless c.olid %}{% assign supex = false %}{% if c.external_url contains 'youtu' %}{% unless c.external_url contains "list" %}
1414
<a href="{{ c.url }}"><img src="https://img.youtube.com/vi/{{ c.external_url | ytid }}/0.jpg" alt="{{ c.title }} Video Thumbnail"></a>{% assign supex = true %}{% endunless %}{% endif %}

‎_includes/highlighted_content.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="content_box with_border">
22
<div class="content_box_header">
3-
{% capture foo %}{% include simple_content_title.html content=include.content %}{% endcapture %}{{ foo | strip_newlines }}
3+
{% capture foo %}{% include_cached simple_content_title.html content=include.content %}{% endcapture %}{{ foo | strip_newlines }}
44
</div>
55
<div class="content_box_desc">{{ include.content.excerpt }}</div>
66
{%- if include.content.course -%}

‎_includes/numbered_content_list.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<ol class="ordinal-content-list">
33
{% for content in sorted %}
44
<li value="{{ content.number }}">
5-
{% include simple_content.html content=content %}
5+
{% include_cached simple_content.html content=content %}
66
</li>
77
{% endfor %}
88
</ol>

0 commit comments

Comments
 (0)