Good evening everyone, I’m working on a site here and I want to include reviews from the business’s google listing. I was wondering what is the best way to do that in Hugo? It would probably have to call the api on page load, not at build time, correct? So it always has the latest reviews? What is the best way to go about it with Hugo?
Please refer to the Places API Documentation.
The Places API and the client libraries are for use in server applications.
Therefore you need to fetch the data on your server and you can only include them in Hugo at build time. It is no longer possible to fetch the data otherwise.
Ok so there’s no way to show live Google reviews on a Hugo site? Is the maps api any different? The docs seemed to show that they might be… Would another option be to spin up another server to read the reviews from Google and then pull them from there in Hugo?
I do not know the answers to your questions. They are not related to Hugo proper and are out of the scope of support in this forum.
I already gave you an answer regarding the Google Places API. They offer access exclusively for server apps.
You need to search other channels for workarounds.
Whatever you end up doing, you can mount the resulting data under Hugo’s
dataDir and render them by using Data Templates.
Ok I’ll check it out! Thanks a lot for taking the time to answer!
getJSON, the results are limited to five reviews. It is unclear to me how those five reviews are selected, but recency seems to be one of the factors.
If you have the Place ID and an API Key, the getJSON request from a Hugo template is trivial. You could build the site daily.
A request to increase the number of reviews has been open for six years. Based on age, I would say the change is unlikely to happen.
If you are the verified owner of a business, you may be able to access all of the reviews with the Google My Business API.
This topic was automatically closed after 24 hours. New replies are no longer allowed.