fix: rewire add-page-by-form so posts actually get created

Two root-cause bugs:
1. Wrong action name: 'add-page-by-form' is not handled by the plugin;
   the plugin only matches 'addpage' or 'add_page'. Using the wrong name
   meant the action silently no-oped while 'message' still fired, showing
   'Entry posted successfully!' for a post that was never written.
2. Config in wrong place: parent/slug/template must be in 'pageconfig' and
   'pagefrontmatter' frontmatter blocks on the form page — the plugin reads
   from page->header(), not from the process block params.

Fix: move config to pageconfig/pagefrontmatter, change action to 'add_page'.
Slug is built from date+title fields (e.g. 2026-06-18-1430-my-title).
Photos destination changed to '@self' so the plugin copies from flash to
the new entry folder correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-18 19:51:58 +02:00
parent 50ab4f522b
commit 6b24215190
+12 -15
View File
@@ -3,7 +3,16 @@ title: 'New Entry'
template: post-form
access:
site.login: true
login_redirect_here: true
pageconfig:
parent: '/tracker'
slug_field: 'date,title'
overwrite_mode: false
pagefrontmatter:
template: entry
published: true
form:
name: new-entry
action: /post
@@ -39,7 +48,7 @@ form:
label: Photos (max 4)
type: file
multiple: true
destination: 'user://pages/01.tracker'
destination: '@self'
limit: 4
accept:
- 'image/*'
@@ -84,19 +93,7 @@ form:
process:
-
add-page-by-form:
parent: '/tracker'
slug: "{{ form.value.date|date('Y-m-d-Hi') }}-{{ form.value.title|lower|regex_replace('/[^a-z0-9]+/', '-')|trim('-') }}"
template: 'entry'
frontmatter:
title: '{{ form.value.title }}'
date: '{{ form.value.date }}'
lat: '{{ form.value.lat }}'
lng: '{{ form.value.lng }}'
location_city: '{{ form.value.location_city }}'
location_country: '{{ form.value.location_country }}'
weather_temp_c: '{{ form.value.weather_temp_c }}'
weather_desc: '{{ form.value.weather_desc }}'
add_page: true
-
message: 'Entry posted successfully!'
-