Hugo Codex currently supports multiple form providers, but adding another provider requires modifying the core form partial.
Would you be open to introducing a pluggable form-provider concept instead?
For example, the configured form_engine could resolve to a provider-specific partial:
layouts/_partials/forms/engines/
├── cloudcannon.html
└── netlify.html
A form configured with:
form_engine: netlify
could be rendered through:
forms/engines/netlify.html
Each provider partial could own the form wrapper, provider-specific attributes, and hidden fields, while continuing to use a shared partial for the normal form fields.
This would allow projects to add their own provider:
layouts/_partials/forms/engines/web3forms.html
without modifying the base Hugo Codex form renderer.
Potential benefits include:
- New providers can be added without changing the core partial.
- Existing provider implementations become self-contained.
- Projects can add or override providers through Hugo’s normal partial lookup mechanism.
- The core form renderer remains provider-agnostic.
- Supporting additional services would not necessarily increase Hugo Codex’s maintenance burden.
I came across this while considering a Web3Forms integration, but the extensibility mechanism seems more generally useful than adding any one provider.
Would this kind of refactoring fit the project’s intended scope? I would be happy to explore an implementation if the approach is of interest.
Hugo Codex currently supports multiple form providers, but adding another provider requires modifying the core form partial.
Would you be open to introducing a pluggable form-provider concept instead?
For example, the configured form_engine could resolve to a provider-specific partial:
A form configured with:
form_engine: netlifycould be rendered through:
forms/engines/netlify.htmlEach provider partial could own the form wrapper, provider-specific attributes, and hidden fields, while continuing to use a shared partial for the normal form fields.
This would allow projects to add their own provider:
layouts/_partials/forms/engines/web3forms.htmlwithout modifying the base Hugo Codex form renderer.
Potential benefits include:
I came across this while considering a Web3Forms integration, but the extensibility mechanism seems more generally useful than adding any one provider.
Would this kind of refactoring fit the project’s intended scope? I would be happy to explore an implementation if the approach is of interest.