Skip to content

Server: custom metadata with a number or true/false value is not shown on the recipe page #838

Open

Description

@dubadub

Problem

The recipe page shows unknown front-matter keys as key: value pills, but only when the value is text. A key whose value is a number or true/false is left out, with no warning. cook recipe in the terminal prints all of them.

To reproduce

---
title: Test
diet: vegan
rating: 4
year: 2022
oven temperature: 180
tested: true
rated: 4/5
---

Mix @flour{200%g}.

Open it in cook server.

  • Shown: 🥗 vegan and rated: 4/5 (YAML reads 4/5 as text).
  • Not shown: rating, year, oven temperature, tested.
  • cook recipe prints all five custom keys.

Seen with 0.38.1 (rating: 4 and rating: 4.5 not shown, rating: 4/5 and rating: "★★★★☆" shown). The code is the same on main (v0.41.1); year, oven temperature and tested above follow from the code and were not run.

Cause

src/web/builders.rs builds the custom pills from string values only, in both places:

  • recipe page: if let (Some(key_str), Some(val_str)) = (key.as_str(), value.as_str())
  • menu page: .filter_map(|(key, value)| Some((key.clone(), value.as_str()?.to_string())))

The get_field closure a few lines above already turns a string, an integer or a float into text for the standard keys.

Expected

A custom key with a number or boolean value gets the same key: value pill as a text value, with numbers formatted as get_field formats them (4, 4.5).

Lists and mappings are a separate matter, covered by #459.

Context

Found while answering a question about showing a recipe rating. A canonical rating key is proposed in cooklang/spec#164; this bug is independent of it and affects any numeric custom key.

Activity

  1. added
    bug
    good first issue
    area: server
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: serverbuggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions