Contact form for Astro static sites
Astro builds static HTML, so a plain form posting to Formlane is all you need. Works with output: 'static'.
- Add the component and import it on your contact page.
- Replace the access key.
- Optional: point `redirect` at /thanks.
src/components/ContactForm.astro
---
const accessKey = import.meta.env.PUBLIC_FORMLANE_KEY ?? "YOUR_ACCESS_KEY";
---
<form action="https://smallwerk.com/formlane/api/submit" method="POST">
<input type="hidden" name="access_key" value={accessKey}>
<!-- Optional: where to send visitors afterwards -->
<input type="hidden" name="redirect" value="https://example.com/thanks">
<!-- Honeypot: leave hidden and empty -->
<input type="checkbox" name="botcheck" style="display:none" tabindex="-1" autocomplete="off">
<input type="text" name="name" placeholder="Name" required>
<input type="email" name="email" placeholder="Email" required>
<textarea name="message" placeholder="Message" required></textarea>
<button type="submit">Send</button>
</form>Get your access key
Free for 250 submissions a month. Data stored in the EU (Frankfurt).
Get your access key