Skip to content

Menu: custom links cannot use relative URLs in admin UI; REST API does not persist custom_url #487

@ckelly8

Description

@ckelly8

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:

  1. Navigate to /_emdash/admin/menus/primary
  2. Click "Add Custom Link"
  3. Enter label: "Contact", URL: /contact
  4. Click "Add" → "Please enter a URL."

REST API:

  1. POST /_emdash/api/menus/primary/items with body {"type":"custom","label":"Contact","custom_url":"/contact","sort_order":3}
  2. Response shows "custom_url": null

Environment

  • emdash version: 0.1.1
  • Platform: Cloudflare Workers (D1) / local dev via Wrangler
  • Template: blog-cloudflare

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions