Static website such as Hexo/Hugo/Jekyll is very popular recent years.
It is fast, easy to write, deploy and host. However, no free lunch: it
is non-trivial to store dynamic information such as pageview counts and
comments under the serverless architecture. This site uses Waline to
implement article view count and comment system.
Accidently I found that we do not have a full site pageview counter.
Waline has post-level counter instead of site-level one.
Just DIY: FiniCounter. Use Vercel serverless function as the web API
framework, MongoDB as the storage. When a user comes to any page of the
site, we invoke the count API through fetch API, increment the counter
in the MongoDB, return the updated value and display in the page.
Initially I want to develop a tool for myself. After I finish it, I
decide to make it as a public free service :-) . FiniCounter looks like
this:
