From cb19de301670e13ff72f6bfa1cf25532fc9ea750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E5=BF=B5?= Date: Fri, 30 Oct 2026 09:48:04 +0800 Subject: [PATCH] fix: form block always shows fields; mailto fallback when no endpoint --- app/blueprints.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/app/blueprints.py b/app/blueprints.py index a3af8fe..af7030c 100644 --- a/app/blueprints.py +++ b/app/blueprints.py @@ -420,20 +420,22 @@ def render_blocks(blocks, site, page, entries): elif typ=='form': btn=escape(resolve('button_text','Contact Us'));href=safe_href(resolve('button_href','/contact-us/')) form_endpoint=site.get('settings',{}).get('form_endpoint','') + email=site.get('settings',{}).get('email','') or site.get('email','') or '' if form_endpoint and str(form_endpoint).startswith('https://'): - form_html=( - f'

{title}

{desc}

' - f'
' - f'
' - f'
' - f'
' - f'
' - f'' - f'
') + action=escape(str(form_endpoint),quote=True);method='POST' + elif email: + action=f'mailto:{escape(email)}?subject=Inquiry from website';method='POST' else: - form_html=(f'

{title}

{desc}

' - f'

Configure an external form endpoint in site settings to enable this form.

' - f'{btn} →
') + action=href;method='GET' + form_html=( + f'

{title}

{desc}

' + f'
' + f'
' + f'
' + f'
' + f'
' + f'' + f'
') parts.append(start+form_html+end) elif typ=='layout': columns=block['columns'];gap=block.get('gap',24)