Skip to content

Commit 14b548c

Browse files
authored
Merge pull request #10 from Slavetomints/feat/index-md-view-counter
feat(views): added viewcounter to index.md
2 parents a585630 + ff72536 commit 14b548c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,28 @@ permalink: /
99
# About Me
1010
<br>
1111

12+
<!-- For view counts -->
13+
<script>
14+
document.addEventListener('DOMContentLoaded', () => {
15+
const pv = document.getElementById('pageviews');
16+
17+
if (pv !== null) {
18+
const uri = location.pathname.replace(/\/$/, '');
19+
const url = `https://slavetomints.goatcounter.com/counter/${encodeURIComponent(uri)}.json`;
20+
21+
fetch(url)
22+
.then((response) => response.json())
23+
.then((data) => {
24+
const count = data.count.replace(/\s/g, '');
25+
pv.innerText = new Intl.NumberFormat().format(count);
26+
})
27+
.catch((error) => {
28+
pv.innerText = '1';
29+
});
30+
}
31+
});
32+
</script>
33+
1234
---
1335

1436
Hello! I'm Slavetomints <a href="https://www.lgbtqnation.com/2022/02/adding-pronouns-email-signatures/" title="Why include pronouns?">(she/her)</a>, a cybersecurity student who helps <a href="https://detraced.org"> DeTraced Security</a> with Cyber Threat Intelligence. Explore my projects, guides, and writeups to dive into my world of cybersecurity adventures.
@@ -110,3 +132,4 @@ You can reach me at the following, please give 1-2 business days for a response:
110132
</ul>
111133

112134
---
135+
<div style="font-size: 12px"><span><i>This page has been viewed <em id="pageviews"></em> times</i></span></div>

0 commit comments

Comments
 (0)