Description
When adding a custom link menu item, relative URLs (e.g., /contact) cannot be saved through the admin UI, and the REST API does not persist the custom_url field at all — even though the seed system and database schema fully support them.
This means the only reliable way to create a custom link menu item with a URL is via emdash seed.
Two related issues
1. Admin UI rejects relative URLs
The "Add Custom Link" dialog at /_emdash/admin/menus/<slug> validates the URL field in a way that rejects relative paths like /contact. Entering /contact and clicking "Add" shows: "Please enter a URL."
Expected: Relative URLs like /contact, /about, /posts should be accepted. These are the most common pattern for internal links and are what the seed system uses.
2. REST API does not persist custom_url
Creating a menu item via POST /_emdash/api/menus/{menu}/items never saves the URL. We tested every plausible field name — all result in custom_url: null:
| Field name |
Relative URL |
Absolute URL |
Result |
custom_url |
/contact |
http://localhost:4321/contact |
null |
url |
/contact |
http://localhost:4321/contact |
null |
href |
/contact |
— |
null |
link |
/contact |
— |
null |
The item is created (label, type, sort_order all save correctly) but the URL is silently dropped.
Evidence that the schema supports relative URLs
Items created via emdash seed store relative URLs correctly in the custom_url column:
{ "type": "custom", "custom_url": "/", "label": "Home" },
{ "type": "custom", "custom_url": "/pages/about", "label": "About" },
{ "type": "custom", "custom_url": "/posts", "label": "Posts" }
These render correctly in the frontend via getMenu().
Steps to reproduce
Admin UI:
- Navigate to
/_emdash/admin/menus/primary
- Click "Add Custom Link"
- Enter label: "Contact", URL:
/contact
- Click "Add" → "Please enter a URL."
REST API:
POST /_emdash/api/menus/primary/items with body {"type":"custom","label":"Contact","custom_url":"/contact","sort_order":3}
- Response shows
"custom_url": null
Environment
- emdash version: 0.1.1
- Platform: Cloudflare Workers (D1) / local dev via Wrangler
- Template: blog-cloudflare
Description
When adding a custom link menu item, relative URLs (e.g.,
/contact) cannot be saved through the admin UI, and the REST API does not persist thecustom_urlfield at all — even though the seed system and database schema fully support them.This means the only reliable way to create a custom link menu item with a URL is via
emdash seed.Two related issues
1. Admin UI rejects relative URLs
The "Add Custom Link" dialog at
/_emdash/admin/menus/<slug>validates the URL field in a way that rejects relative paths like/contact. Entering/contactand clicking "Add" shows: "Please enter a URL."Expected: Relative URLs like
/contact,/about,/postsshould be accepted. These are the most common pattern for internal links and are what the seed system uses.2. REST API does not persist
custom_urlCreating a menu item via
POST /_emdash/api/menus/{menu}/itemsnever saves the URL. We tested every plausible field name — all result incustom_url: null:custom_url/contacthttp://localhost:4321/contactnullurl/contacthttp://localhost:4321/contactnullhref/contactnulllink/contactnullThe item is created (label, type, sort_order all save correctly) but the URL is silently dropped.
Evidence that the schema supports relative URLs
Items created via
emdash seedstore relative URLs correctly in thecustom_urlcolumn:{ "type": "custom", "custom_url": "/", "label": "Home" }, { "type": "custom", "custom_url": "/pages/about", "label": "About" }, { "type": "custom", "custom_url": "/posts", "label": "Posts" }These render correctly in the frontend via
getMenu().Steps to reproduce
Admin UI:
/_emdash/admin/menus/primary/contactREST API:
POST /_emdash/api/menus/primary/itemswith body{"type":"custom","label":"Contact","custom_url":"/contact","sort_order":3}"custom_url": nullEnvironment