daviddarnes / alembic

⚗️ A Jekyll boilerplate theme designed to be a starting point for any Jekyll website
https://alembic.darn.es
MIT License
754 stars 894 forks source link

[Feature] Added support for custom Formspree endpoints #155

Closed ManuelFte closed 1 year ago

ManuelFte commented 4 years ago

Added a setting to allow optional usage of custom Formspree endpoints, rather than using the email address itself as endpoint, which exposes it to the public as part of the POST request.

This also makes it possible to have multiple forms delivering to different addresses.

daviddarnes commented 4 years ago

This is a super nice addition, thank you @ManuelFte. The Formspree team will be pleased, the email method is kinda legacy 😅

daviddarnes commented 3 years ago

Sorry for the delay @ManuelFte. This is looking good! There appears to be a typo on line 18, site:email should be site.email.

Also wondering if we can omit the JavaScript if the email isn't being used, as it's only there to prevent spambots getting peoples' emails 🤔

What if the unless around the <script> block checked for endpoint too? And then make the action value:

{% if include.endpoint %}https://formspree.io/{{ include.endpoint }}{% else %}{{ thanks_url }}{% endif %}

Doing it this way removes the need for the assign at the top, and only applies the JavaScript when they're using it with their email. Does that make sense?

daviddarnes commented 3 years ago

@ManuelFte hey there! I know it's been a while since we talked about this addition. I really appreciate you taking the time to contribute, but I think this update needs to be approached in a more simplified manner.

The old way of achieving these contact forms was with a single email, so it made sense to place it into the config file and used throughout the site. However now most form services provide an endpoint for you to add to a particular form on your site. In that case the most of the form code in the theme can be removed and instead the form component could just accept and endpoint key directly in it.

I'm going to keep this issue open until I've come up with a solution. However if you beat me to the punch I'll defined merge it. Thanks again!

daviddarnes commented 1 year ago

Sorry @ManuelFte but I'm going to have to close this PR since it's been open for over 2 years and I'm getting additional requests to fix this. Regardless I appreciate your contributions!