Add comments to an Astro site

Add a comment section with AI moderation to an Astro blog. A web component, so no framework integration or client directive is needed.

<crow-comments> is a standard web component. Astro renders it as plain HTML, and the script turns it into a comment section in the browser.

Create a widget

Sign in to Crowment, create a comment widget for your site's domain and copy its app key from Install & Embed.

Load the script once in your layout

Add the script to the <head> of your base layout. is:inline tells Astro to leave the external script as it is.

src/layouts/BaseLayout.astro
<head>
  <!-- your existing head tags -->
  <script is:inline defer src="https://embeds.crowment.com/comments.js"></script>
</head>

Add the comment section to your posts

Put the element where the comments should appear, usually after the post content:

src/layouts/BlogPost.astro
<article>
  <slot />
</article>

<crow-comments app-key="YOUR_APP_KEY"></crow-comments>

Check a post

Run npm run dev and open a post. Each post gets its own thread, identified by its URL path.

The widget follows client-side navigation by itself, so it keeps working with Astro's view transitions.

Next steps

Ready to add comments to your website?

Get started in minutes with Crowment's simple comment widget. No coding required — just copy, paste, and engage with your visitors.