Fixed the PV cache.
This commit is contained in:
parent
42e0617bde
commit
e87ef0d40e
5 changed files with 21 additions and 11 deletions
|
@ -8,10 +8,18 @@
|
|||
|
||||
{% if page.layout == 'home' %}
|
||||
|
||||
{% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %}
|
||||
<script src="{{ '/assets/js/data/pv-cache.js' | relative_url }}"></script>
|
||||
{% endif %}
|
||||
|
||||
<script src="{{ '/assets/js/home.min.js' | relative_url }}" async></script>
|
||||
|
||||
{% elsif page.layout == 'post' %}
|
||||
|
||||
{% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %}
|
||||
<script src="{{ '/assets/js/data/pv-cache.js' | relative_url }}"></script>
|
||||
{% endif %}
|
||||
|
||||
<script src="{{ '/assets/js/post.min.js' | relative_url }}" async></script>
|
||||
|
||||
{% if page.math %}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
{% if site.google_analytics.pv.enabled %}
|
||||
|
||||
{% include_relative data/pv-data.js %}
|
||||
const proxyData = '{"url": "{{ site.google_analytics.pv.proxy_endpoint }}"}';
|
||||
|
||||
{% include_relative _utils/pageviews.js %}
|
||||
|
||||
|
|
|
@ -106,6 +106,6 @@ const include = [
|
|||
];
|
||||
|
||||
const exclude = [
|
||||
'/assets/js/data/pv-data.js',
|
||||
'/assets/js/data/pv-cache.js',
|
||||
'/img.shields.io/'
|
||||
];
|
||||
|
|
11
assets/js/data/pv-cache.js
Normal file
11
assets/js/data/pv-cache.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
layout: compress
|
||||
---
|
||||
|
||||
{%- capture pv_data -%}
|
||||
{%- if site.google_analytics.pv.cache and site.google_analytics.pv.enabled -%}
|
||||
{% include_relative _pageviews.json %}
|
||||
{%- endif -%}
|
||||
{%- endcapture -%}
|
||||
|
||||
const pageviews = '{{ pv_data }}';
|
|
@ -1,9 +0,0 @@
|
|||
const proxyData = '{"url": "{{ site.google_analytics.pv.proxy_endpoint }}"}';
|
||||
|
||||
{%- capture pv_data -%}
|
||||
{%- if site.google_analytics.pv.cache and site.google_analytics.pv.enabled -%}
|
||||
{% include_relative data/_pageviews.json %}
|
||||
{%- endif -%}
|
||||
{%- endcapture -%}
|
||||
|
||||
const pageviews = '{{ pv_data }}';
|
Loading…
Reference in a new issue