1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 05:41:31 +00:00

Fix PV display when baseurl exists

This commit is contained in:
Cotes Chung
2021-01-18 23:25:09 +08:00
parent 0194bbced9
commit ab0e3f6ee4
3 changed files with 14 additions and 10 deletions

View File

@@ -12,3 +12,5 @@ const proxyEndpoint = "{{ site.google_analytics.pv.proxy_endpoint }}";
{% endif %}
const pvCacheEnabled = {{ enabled }};
const pvCacheData = "{{ '/assets/js/data/pageviews.json' | relative_url }}";

View File

@@ -173,9 +173,9 @@ function fetchProxyPageviews() {
function fetchPageviews(fetchOrigin = true, filterOrigin = false) {
/* pvCacheEnabled see: /assets/js/_pv-config.js */
/* pvCacheEnabled, pvCacheData see: /assets/js/_pv-config.js */
if (pvCacheEnabled && fetchOrigin) {
fetch("/assets/js/data/pageviews.json")
fetch(pvCacheData)
.then((response) => response.json())
.then((data) => {
if (filterOrigin) {