Skip to content

Commit

Permalink
Revert "Cache is not enough? Ok, let's cache sidebar, scripts and 3rd…
Browse files Browse the repository at this point in the history
…-party's."

This reverts commit bb5cfe6.
  • Loading branch information
stevenjoezhang committed Dec 29, 2018
1 parent bb5cfe6 commit 666aa6e
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 29 deletions.
41 changes: 20 additions & 21 deletions layout/_layout.swig
Original file line number Diff line number Diff line change
Expand Up @@ -94,31 +94,30 @@
{% endif %}
</div>

{{ partial('_scripts/vendors.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_scripts/commons.swig', {}, {cache: theme.cache.enable}) }}
{% include '_scripts/vendors.swig' %}
{% include '_scripts/commons.swig' %}

{% set scheme_script = '_scripts/schemes/' + theme.scheme | lower + '.swig' %}
{{ partial(scheme_script, {}, {cache: theme.cache.enable}) }}
{% include scheme_script %}

{% block script_extra %}{% endblock %}

{{ partial('_scripts/boostrap.swig', {}, {cache: theme.cache.enable}) }}

{{ partial('_third-party/comments/index.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/search/index.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/analytics/lean-analytics.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/analytics/firestore.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/seo/baidu-push.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/schedule.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/math/index.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/needsharebutton.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/rating.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/pangu.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/scroll-cookie.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/exturl.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/bookmark.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/copy-code.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/pdf.swig', {}, {cache: theme.cache.enable}) }}

{% include '_scripts/boostrap.swig' %}

{% include '_third-party/comments/index.swig' %}
{% include '_third-party/search/index.swig' %}
{% include '_third-party/analytics/lean-analytics.swig' %}
{% include '_third-party/analytics/firestore.swig' %}
{% include '_third-party/seo/baidu-push.swig' %}
{% include '_third-party/schedule.swig' %}
{% include '_third-party/math/index.swig' %}
{% include '_third-party/needsharebutton.swig' %}
{% include '_third-party/rating.swig' %}
{% include '_third-party/pangu.swig' %}
{% include '_third-party/scroll-cookie.swig' %}
{% include '_third-party/exturl.swig' %}
{% include '_third-party/bookmark.swig' %}
{% include '_third-party/copy-code.swig' %}
{% include '_third-party/pdf.swig' %}
</body>
</html>
5 changes: 3 additions & 2 deletions layout/_partials/sidebar.swig → layout/_macro/sidebar.swig
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% macro render(is_post) %}
<div class="sidebar-toggle">
<div class="sidebar-toggle-line-wrap">
<span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
Expand All @@ -12,7 +13,7 @@
{% endif %}
<div class="sidebar-inner">

{% set display_toc = is_post and theme.toc.enable %}
{% set display_toc = is_post and theme.toc.enable or is_page and theme.toc.enable %}

{% if display_toc and toc(page.content).length > 1 %}
<ul class="sidebar-nav motion-element">
Expand Down Expand Up @@ -83,7 +84,6 @@
{% if hasTagsPage %}</a>{% endif %}
</div>
{% endif %}

</nav>
{% endif %}

Expand Down Expand Up @@ -186,3 +186,4 @@

</div>
</aside>
{% endmacro %}
3 changes: 2 additions & 1 deletion layout/archive.swig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% extends '_layout.swig' %}
{% import '_macro/post-collapse.swig' as post_template %}
{% import '_macro/sidebar.swig' as sidebar_template %}

{% block title %}{{ __('title.archive') }} | {{ title }}{% endblock %}

Expand Down Expand Up @@ -59,5 +60,5 @@
{% endblock %}

{% block sidebar %}
{{ partial('_partials/sidebar.swig', {}, {cache: theme.cache.enable}) }}
{{ sidebar_template.render(false) }}
{% endblock %}
3 changes: 2 additions & 1 deletion layout/category.swig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% extends '_layout.swig' %}
{% import '_macro/post-collapse.swig' as post_template %}
{% import '_macro/sidebar.swig' as sidebar_template %}

{% block title %}{{ __('title.category') }}: {{ page.category }} | {{ title }}{% endblock %}

Expand Down Expand Up @@ -33,5 +34,5 @@
{% endblock %}

{% block sidebar %}
{{ partial('_partials/sidebar.swig', {}, {cache: theme.cache.enable}) }}
{{ sidebar_template.render(false) }}
{% endblock %}
3 changes: 2 additions & 1 deletion layout/index.swig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% extends '_layout.swig' %}
{% import '_macro/post.swig' as post_template %}
{% import '_macro/sidebar.swig' as sidebar_template %}

{% block title %}{{ title }}{% if theme.index_with_subtitle and subtitle %} – {{ subtitle }}{% endif %}{% endblock %}

Expand All @@ -18,5 +19,5 @@
{% endblock %}

{% block sidebar %}
{{ partial('_partials/sidebar.swig', {}, {cache: theme.cache.enable}) }}
{{ sidebar_template.render(false) }}
{% endblock %}
3 changes: 2 additions & 1 deletion layout/page.swig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends '_layout.swig' %}
{% import '_macro/sidebar.swig' as sidebar_template %}

{% block title %}{#
#}{% set page_title_suffix = ' | ' + title %}{#
Expand Down Expand Up @@ -78,7 +79,7 @@
{% endblock %}

{% block sidebar %}
{{ partial('_partials/sidebar.swig', {}, {cache: theme.cache.enable}) }}
{{ sidebar_template.render(false) }}
{% endblock %}

{% block script_extra %}
Expand Down
7 changes: 6 additions & 1 deletion layout/post.swig
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
{% extends '_layout.swig' %}
{% import '_macro/post.swig' as post_template %}
{% import '_macro/sidebar.swig' as sidebar_template %}


{% block title %}{{ page.title }} | {{ title }}{% endblock %}

{% block page_class %}page-post-detail{% endblock %}


{% block content %}

<div id="posts" class="posts-expand">
{{ post_template.render(page) }}
</div>

{% endblock %}

{% block sidebar %}
{{ partial('_partials/sidebar.swig', {}, {cache: theme.cache.enable}) }}
{{ sidebar_template.render(true) }}
{% endblock %}

{% block script_extra %}
Expand Down
3 changes: 2 additions & 1 deletion layout/tag.swig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% extends '_layout.swig' %}
{% import '_macro/post-collapse.swig' as post_template %}
{% import '_macro/sidebar.swig' as sidebar_template %}

{% block title %}{{ __('title.tag') }}: {{ page.tag }} | {{ title }}{% endblock %}

Expand Down Expand Up @@ -32,5 +33,5 @@
{% endblock %}

{% block sidebar %}
{{ partial('_partials/sidebar.swig', {}, {cache: theme.cache.enable}) }}
{{ sidebar_template.render(false) }}
{% endblock %}

0 comments on commit 666aa6e

Please sign in to comment.