Adding like functionality to blog pages using data file

I want to add a like functionality for my blog pages, I figure I would need to use a data file but m having trouble conceiving the flow. Fetch from the data file then add via ajax which will in turn reload the data file again ?

Hugo is a static site generator.

You would need to use a database to store a “like”.

Then you could either retrieve the like on your website’s frontend via JS or export the like count in a JSON file and configure Hugo to retrieve it with the getJSON function on scheduled builds.

The JS approach would display the like count on real time.

Tthe Hugo approach would not require JS but it would not display the like count on real time but rather whenever the site is published.


Have a look at this article for a serverless approach.


This looks doable I will give a try many thanks

I was able to make this work, many thanks for the suggestions :grinning_face_with_smiling_eyes:

Good to hear. The link I posted above was for Nuxt. It would be useful if you could take the time and provide a brief tutorial in this topic, for people who may want to add this functionality to Hugo.

A post was split to a new topic: Adding like button to a static blog site using Hugo-Netlify & Fauna

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.