diff options
author | uPagge <git@upagge.ru> | 2021-02-18 18:53:44 +0300 |
---|---|---|
committer | uPagge <git@upagge.ru> | 2021-02-18 18:53:44 +0300 |
commit | 826a9f505a321f86c04b5c262935f3056c75e56a (patch) | |
tree | 2fa13fd40c4f480f8b67792055432cde7787256e /layouts/posts | |
parent | 5c698388982ac895f01cf8a2e7bc6bb630e25969 (diff) |
hit
Diffstat (limited to 'layouts/posts')
-rw-r--r-- | layouts/posts/single.html | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 50af158..b8ef588 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -26,7 +26,7 @@ {{- end -}} {{- $pageTheme := $params.Theme | default .Site.Params.Page.theme | default "classic" -}} - +{{ $params.UniqueId }} <div class="container content-article {{ if eq $toc.keepStatic false }}page-toc{{ end }} theme-{{ $pageTheme }}"> {{- /* Auto TOC */ -}} @@ -260,12 +260,13 @@ <script> document.addEventListener('DOMContentLoaded', function () { const host = '{{ $viewCounter.url }}'; - const url = host + '/hit/{{ $viewCounter.key }}' + window.location.pathname; + const pathName = window.location.pathname.replaceAll('/', '_') + const url = host + '/hit/{{ $viewCounter.key }}/' + pathName.substring(1).slice(0, -1); const request = new XMLHttpRequest(); request.open('GET', url, true); request.onload = function () { if (this.status >= 200 && this.status < 400) { - var response = JSON.parse(this.response); + const response = JSON.parse(this.response); const views = response.views; if (views >= 25 && document.querySelector("#views_value") != null) { document.querySelector("#views_value").textContent = response.views.toLocaleString(undefined, {minimumFractionDigits: 0}); |