Pageview

Display PageViews and List of Popular Posts on a Static Site

Sep 6, 2019
Hugo, Static Site, Pageview

A static site, like this one based on Hugo, cannot easily display site statistics. But there’s a solution. When the page is loaded on the client side, a Javascript pulls the relevant statistics from my server then render it to the page. The server runs a small Python program to contact Google Analytics API in order to get the statistics and return to the frontend. We can even use it to build a list of popular posts. ...