diff --git a/_includes/js-selector.html b/_includes/js-selector.html
index e77930e..3f8a873 100644
--- a/_includes/js-selector.html
+++ b/_includes/js-selector.html
@@ -8,10 +8,18 @@
{% if page.layout == 'home' %}
+ {% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %}
+
+ {% endif %}
+
{% elsif page.layout == 'post' %}
+ {% if site.google_analytics.pv.cache and site.google_analytics.pv.enabled %}
+
+ {% endif %}
+
{% if page.math %}
diff --git a/assets/js/_home-post.js b/assets/js/_home-post.js
index afc128b..48f5dc4 100644
--- a/assets/js/_home-post.js
+++ b/assets/js/_home-post.js
@@ -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 %}
diff --git a/assets/js/data/cache-list.js b/assets/js/data/cache-list.js
index 65966bb..31db1b8 100644
--- a/assets/js/data/cache-list.js
+++ b/assets/js/data/cache-list.js
@@ -106,6 +106,6 @@ const include = [
];
const exclude = [
- '/assets/js/data/pv-data.js',
+ '/assets/js/data/pv-cache.js',
'/img.shields.io/'
];
diff --git a/assets/js/data/pv-cache.js b/assets/js/data/pv-cache.js
new file mode 100644
index 0000000..2e309bf
--- /dev/null
+++ b/assets/js/data/pv-cache.js
@@ -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 }}';
diff --git a/assets/js/data/pv-data.js b/assets/js/data/pv-data.js
deleted file mode 100644
index eaceee8..0000000
--- a/assets/js/data/pv-data.js
+++ /dev/null
@@ -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 }}';
\ No newline at end of file