Skip to content

Commit b1af01f

Browse files
committed
Fixed the PV cache.
1 parent 07f6534 commit b1af01f

5 files changed

Lines changed: 21 additions & 11 deletions

File tree

_includes/js-selector.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@
88

99
{% if page.layout == 'home' %}
1010

11+
{% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %}
12+
<script src="{{ '/assets/js/data/pv-cache.js' | relative_url }}"></script>
13+
{% endif %}
14+
1115
<script src="{{ '/assets/js/home.min.js' | relative_url }}" async></script>
1216

1317
{% elsif page.layout == 'post' %}
1418

19+
{% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %}
20+
<script src="{{ '/assets/js/data/pv-cache.js' | relative_url }}"></script>
21+
{% endif %}
22+
1523
<script src="{{ '/assets/js/post.min.js' | relative_url }}" async></script>
1624

1725
{% if page.math %}

assets/js/_home-post.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
{% if site.google_analytics.pv.enabled %}
1515

16-
{% include_relative data/pv-data.js %}
16+
const proxyData = '{"url": "{{ site.google_analytics.pv.proxy_endpoint }}"}';
1717

1818
{% include_relative _utils/pageviews.js %}
1919

assets/js/data/cache-list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,6 @@ const include = [
106106
];
107107

108108
const exclude = [
109-
'/assets/js/data/pv-data.js',
109+
'/assets/js/data/pv-cache.js',
110110
'/img.shields.io/'
111111
];

assets/js/data/pv-cache.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
layout: compress
3+
---
4+
5+
{%- capture pv_data -%}
6+
{%- if site.google_analytics.pv.cache and site.google_analytics.pv.enabled -%}
7+
{% include_relative _pageviews.json %}
8+
{%- endif -%}
9+
{%- endcapture -%}
10+
11+
const pageviews = '{{ pv_data }}';

assets/js/data/pv-data.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)