Table of Contents
Adding a newsletter signup form to your Hugo site is a great way to build your email list and engage with your visitors. Although Hugo is a static site generator, you can still easily integrate third-party services to collect email addresses.
Choosing a Newsletter Service
First, select a newsletter provider that offers embeddable signup forms. Popular options include Mailchimp, ConvertKit, and Sendinblue. These services provide ready-to-use HTML forms that you can embed directly into your Hugo site.
Embedding the Signup Form
Once you’ve signed up with a newsletter service, locate the embed code for the signup form. It typically appears in the form of a small HTML snippet. Copy this code to your clipboard.
Next, open your Hugo site’s content directory and choose the page where you want the signup form to appear, such as index.md or a dedicated subscribe.md page. Insert the embed code within the page’s content using an HTML block.
Adding the Signup Form to Your Hugo Site
In your Hugo project, create or edit the relevant content file. Use the following structure:
+++
title = "Subscribe to Our Newsletter"
+++
<!-- Paste your newsletter embed code here -->
<form action="https://yournewsletterservice.com/subscribe" method="post">
<input type="email" name="email" placeholder="Enter your email" required>
<button type="submit">Subscribe</button>
</form>