mirror of
https://github.com/maikka39/Personal-Website.git
synced 2026-10-02 14:46:25 +00:00
17 lines
574 B
HTML
17 lines
574 B
HTML
{{- if .Site.Params.goatCounter }}
|
|
<span id="{{ .File.UniqueID }}" title="{{ i18n "post.pageViews" }}">{{ i18n "post.unknownViews" }}</span>
|
|
<script async>
|
|
let url =
|
|
"https://{{ .Site.Params.goatCounter }}/counter/" +
|
|
encodeURIComponent({{ .RelPermalink }}.replace(/(\/)?$/, "")) +
|
|
".json";
|
|
|
|
fetch(url)
|
|
.then(res => res.json())
|
|
.then(data => data.count)
|
|
.then(count => {
|
|
document.getElementById("{{ .File.UniqueID }}").innerText = count + " " + {{ i18n "post.pageViews" }};
|
|
});
|
|
</script>
|
|
{{- end}}
|