Skip to content

Display custom recipe metadata (e.g. nutrition) on the recipe page #459

Description

@Tloxipeuhca

Problem

Cooklang's YAML frontmatter supports arbitrary custom metadata keys beyond the standard ones (servings, time, course, ...), but CookCLI's web UI only shows a handful of known fields as pills, plus flat scalar custom fields as key: value pills. There's no good way to show structured custom metadata — the most common example being nutrition facts (calories, protein, fat, ...) that many recipe collections carry per recipe.

Proposal

Any non-standard YAML key whose value is a list or a mapping should render as its own line on the recipe page, below the tags — one line per "family":

nutrition:
  kcal: 234
  proteins: 9.8
  lipids: 17.6
allergens:
  - gluten
  - tree nuts
  • Works generically for any such key with no code changes — allergens: above should just work.
  • A couple of well-known families (nutrition, and file metadata like created-by/modified-at) could get nicer treatment: matching icons, and translated field names via the existing i18n system.
  • The recipe list page could show a compact calorie badge next to the tags when nutrition is present, without cluttering the cards with the rest of the nutrition breakdown.
  • A way to hide a family or a single entry from display (e.g. a .-prefixed key) would help for metadata that's useful to keep in the file but not show on the page.

Proposed implementation

Opened as #458, which implements the above (generic rendering for any family, specific icon/i18n treatment for nutrition and file/meta, .-prefix hiding, kcal badge on the list page).

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