How to add comments to Astro

What is Astro?

Modern component-based static site generator. Whether you're building a marketing site, documentation or blog, Astro handles the heavy lifting of converting your content into clean, performant HTML.

Why add comments to your Astro site?

Adding comments brings your blog to life by letting readers discuss your posts. Comments show your content resonates with real people. They improve SEO with fresh user-generated content and help you learn what your audience wants.

Chirp Form gives you a simple solution that works perfectly with Astro's static architecture while respecting visitor privacy with EU hosting and GDPR compliance.

How Chirp Form works with Astro

Chirp Form uses two elements: <chirp-form> for submitting comments and <chirp-feed> to display them. Chirp Form handles everything behind the scenes. It stores submissions, filters spam and sends email notifications while your Astro site stays completely static. Submissions are identified through privacy-friendly cryptographic hashing rather than storing IP addresses or personal data directly.

Installation steps

Step 1: Add the Chirp Form script

Add the Chirp Form script to your Astro layout file. For most sites this goes in src/layouts/Layout.astro in the <head> section:

<head>
  <!-- Your existing head content -->
  <script defer src="https://embed.chirpform.com/latest/chirpform.umd.js"></script>
</head>

The defer attribute ensures the script loads without blocking your page content.

Step 2: Add to your post layout

Add both Chirp elements to src/layouts/BlogPost.astro after your post content:

<article>
  <slot />
</article>

<!-- Chirp Comments -->
<section class="comments">
  <h2>Comments</h2>
  <chirp-form form-id="YOUR_FORM_ID"></chirp-form>

  <chirp-feed form-id="YOUR_FORM_ID" filter-url="current"></chirp-feed>
</section>

The filter-url="current" ensures comments are unique to each post. Replace YOUR_FORM_ID with your actual form ID from your Chirp Form dashboard.

Step 3: Configure your form (optional)

You can fully customize your form fields through your Chirp Form dashboard. The form automatically fetches your configuration and renders everything you've set up.

For styling, you can fully customize the appearance using standard CSS. Check the styling documentation for detailed customization options.

Alternative solutions

Unlike other form services, Chirp Form is hosted and run from the EU. It doesn't store massive amounts of unencrypted data or track users across the web. You get a straightforward solution that respects your visitors' privacy.

Get started with Chirp Form on Astro

Ready to add comments to your Astro site? Sign up for Chirp Form and get your form ID to start collecting comments in minutes.

Related guides

More ways to use Chirp Form with Astro: contact form and testimonials.

Want to add comments with Chirp Form to a different platform?

Add forms to any site. Display responses anywhere.

Try Chirp Form for free. No credit card required.