Add testimonials to a Hugo site
Collect and show customer testimonials on a Hugo site with SiteBackend - a partial, a shortcode for Markdown content, and no server.
Hugo builds static HTML, and SiteBackend testimonials load in the visitor's browser, so they work on any static host.
Get the IDs from your site's Testimonials tab in the dashboard: Collect for the form customers fill in (c_…), and Widgets for the wall, carousel, highlight or badge that shows approved ones (w_…).
Create a partial
<div data-sitebackend-widget="{{ . }}"></div>
<script src="https://sitebackend.com/widget.js" async></script>Include it in any template and pass the ID:
<h2>What our customers say</h2>
{{ partial "testimonials.html" "w_YOUR_WIDGET_ID" }}It's fine for the script to appear more than once on a page; it only runs once.
Use it inside Markdown content
Hugo doesn't run partials inside Markdown, and it doesn't render raw HTML there by default. Wrap the partial in a shortcode:
{{ partial "testimonials.html" (.Get 0) }}Then write this in any content file:
Worked with us? Tell us how it went.
{{</* testimonials "c_YOUR_COLLECT_ID" */>}}Local development
Widgets work on localhost:1313 even when your site has a domain set in the dashboard: localhost and 127.0.0.1 are always allowed. Preview addresses on other domains, such as a Netlify deploy preview, are blocked, though. See sites.
For a contact form on the same site, see add a contact form to a Hugo site.