Skip to content

Commit c244452

Browse files
committed
feat(footer): add goatcounter number in footer
1 parent 00c14df commit c244452

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

website/_quarto.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ format:
1313
html:
1414
css: styles/styles.css
1515
include-in-header: styles/goatcounter.html
16+
include-after-body: styles/goatcounter.js
1617
theme:
1718
light: flatly
1819
dark: darkly
@@ -35,7 +36,9 @@ website:
3536
site-url: "https://benson1231.github.io/tools/"
3637
favicon: assets/logo.svg
3738
back-to-top-navigation: true
38-
page-footer: "Copyright 2026, benson1231"
39+
page-footer: |
40+
Copyright 2026, benson1231
41+
👀 Total Views: <span id="gc-total">Loading...</span>
3942
navbar:
4043
pinned: true
4144
left:

website/styles/goatcounter.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
fetch("https://benson1231.goatcounter.com/counter//.json")
2+
.then(res => res.json())
3+
.then(data => {
4+
const el = document.getElementById("gc-total");
5+
if (el) {
6+
el.innerText = data.count;
7+
}
8+
})
9+
.catch(() => {
10+
console.log("GoatCounter fetch failed");
11+
});

0 commit comments

Comments
 (0)