11ty Logo

Eleventy Edge: Forms

← Return to the Full list of Eleventy Edge Demos


Learn more on 11ty.dev: Eleventy Edge Plugin documentation

Source Code

Username Display

{% edge %}{% if eleventy.edge.cookies.username.size > 0 %}<h2>Welcome {{ eleventy.edge.cookies.username | url_decode }}! 👋🏻 🌊</h2>{% endif %}{% endedge %}

Hybrid Edge Form

<form action="{{ page.url }}" method="post">
<label>Your Name <input type="text" name="username" value="{% edge %}{{ eleventy.edge.cookies.username | url_decode }}{% endedge %}"></label>
<button type="submit">Save</button>
</form>

Edge Function

./netlify/edge-functions/forms.js