# fn-18.3 WebUI: frontmatter date sort options

## Description

WebUI: expose frontmatter-based sorting options when present in a collection.

Scope:

- Detect date-like frontmatter fields during indexing (reuse metadata extraction).
- For a collection with >=1 date field, expose sort choices in UI (e.g., Newest by <field>, Oldest by <field>).
- Use stored doc_date per field for sorting (no client-side parse).
- Fallback to file modified if field missing on doc.
- Keep non-date fields out of sort menu.

## Acceptance

- collection exposes available frontmatter date fields via API
- UI shows sort options only when date fields exist for current collection
- selecting frontmatter sort orders results by that field desc/asc, fallback to modified date
- no parsing in UI; uses server-provided sort
- tests cover at least 2 date fields across docs in same collection

## Done summary

Added frontmatter date-field sorting end-to-end: ingest stores normalized date_fields, store/API expose available date keys, /api/docs validates and applies sortField/sortOrder with modified fallback, and Browse UI shows conditional sort options. Added adapter/API/ingestion tests for date-field discovery and ordering.

## Evidence

- Commits:
- Tests: bun run lint:check, bun test, bun run eval, bun scripts/docs-verify.ts, bun test test/store/adapter.test.ts test/serve/api-tags.test.ts test/ingestion/sync-tags.test.ts
- PRs:
