mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-19 06:06:54 +00:00
fix: ensure pageviews are fetched after DOM is loaded (#2071)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<!-- Display GoatCounter pageviews -->
|
||||
<script>
|
||||
let pv = document.getElementById('pageviews');
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const pv = document.getElementById('pageviews');
|
||||
|
||||
if (pv !== null) {
|
||||
const uri = location.pathname.replace(/\/$/, '');
|
||||
@@ -16,4 +17,5 @@
|
||||
pv.innerText = '1';
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user