Skip to content

Directory

Available format: directory turns a storyStoryThe compiled model, Story: one source, which every format reads. into a directory: an "awesome" list read as it is, each ## heading a category, each item an entry (- [Name](url) - summary). The same file is shown as cards, a list or a table, filtered by category, tag, city and country in the URL (?category=studios&city=Paris, shareable), and, with pages: true, a page per entry.

The example is directory-links (a raw awesome list, no braces). The glossary shares the same model of entries.

A minimal directory

Markdownplaces.md
--- title: Lorem Places format: directory lang: en entries: places # links | places | organizations view: cards # cards | list | table pages: false --- --- id=studios ## Studios - [Lorem Studio](https://example.com) - Dolor sit amet. {tags=design,print street="1 Lorem Street" city=Paris postcode=75000 country=FR geo=48.8566,2.3522} - [Ipsum Lab](https://example.org) - Consectetur adipiscing. {tags=video city=Lyon country=FR} --- id=venues ## Venues - [Dolor Hall](https://example.net) - Sed do eiusmod. {tags=music city=Paris country=FR sponsored} :::entry{id=dolor-hall} The long record of an entry, in Markdown, when one line is not enough: opening hours, access. :::
In the {…} of an entryWhat it is
iddefault: the slug of the name
tagscomma-separated
email, phone, imagecontact; image is a local file, never fetched from the site
street, city, postcode, region, country, geothe place: country in ISO 3166 (FR), geo as lat,lng
addressfree text, shown as it is, never parsed
sponsoreda visible mention and rel="sponsored"

A :::entry{id=…} block after the items holds the long record of the entry with that id; an id that is not an entry of the section is an error. A link is http: or https: only. Country names are shown in the page's language (Intl.DisplayNames).

Settings

In the front matter, or for every directory of a folder in the directory: section of recit.config.ts (the front matter wins).

SettingDefaultWhat it does
entrieslinkswhat one entry is: links, places or organizations
viewcardsthe view shown first: cards, list, table or map (the map needs the maps package)
pagesfalseone page per entry
facets[category, tags]the filters offered, in order, in the URL: category, tags, city, country
strictfalseevery entry writes its {id=…}; an entry without one is an error
pdfA4 portrait, a listrecit export --to pdf: view (list, table or cards), the page box

With strict: true (front matter, or directory: { strict: true } in recit.config), every entry writes its id. Each entry without one is an error of recit validate and of the build, at its line: in the directory above, under directory: { strict: true }, Lorem Studio (places.md:14), Ipsum Lab (✖ places.md:15 — entry "Ipsum Lab" has no id (strict)) and Dolor Hall (places.md:21). A :::entry{id=…} block does not count: the id goes in the {…} of the item, {id=ipsum-lab tags=video city=Lyon country=FR}. A companion file that completes an entry (the linkStatus of recit validate --links) leaves the rule as it is. This is not --strict of recit validate --links, which turns broken links into errors.

TypeScriptrecit.config.ts
import { defineConfig } from "recit/config"; export default defineConfig({ directory: { entries: "places", view: "table", facets: ["category", "city", "country"], strict: true, }, });

The map view

On the page served by recit dev or built by recit build, when at least one entry has coordinates (geo=lat,lon, or a place whose entry in the places directory has them), Map appears alongside Cards, List and Table and marks every entry that matches the active filters on the country base map of @recit/geo (static SVG, no external tiles). Set view: map in the front matter or under directory: in recit.config.ts to open on the map first; when no entry has a geolocated place, the option is not offered and view: map falls back to Cards. When the filters leave no entry with coordinates, the map view says so instead of drawing an empty map. A glossary, or a directory without coordinates, does not need @recit/geo and its page does not carry the map.

Markdownplaces.md
--- title: Lorem Places format: directory entries: places view: map --- ## Studios - [Lorem Studio](https://example.com) - Dolor sit amet. {tags=design,print street="1 Lorem Street" city=Paris postcode=75000 country=FR geo=48.8566,2.3522}

A React component that embeds Directory (@recit/directory/components) can provide its map through the renderMap(markers) prop (view: "map" falls back to cards without it); entryMarkers(entries) from @recit/directory returns the ::map marker layers for the geolocated entries.

Proposals through a form

Visitors can propose an entry without writing Markdown; nothing is published before you read it. entryProposalForm from @recit/directory writes the :::form block, its fields named like the columns of a directory table (name, url, summary, category, tags, email, city, country), in English or French (lang). Pass the categories you offer, your endpoint (submit, mock by default) and your privacy page (privacy); without one, the form asks for consent.

TypeScriptTypeScript
import { entryProposalForm } from "@recit/directory"; const markdown = entryProposalForm({ lang: "fr", categories: ["Studios", "Venues"], submit: "/api/forms", privacy: "/privacy", });

Where the submission arrives (onSubmit of createFormHandler in @recit/form/server), submissionToEntry(data, { categories }) checks it against the entry schema: an address that is not http: or https:, an invalid email or a category you did not offer is refused with its issues (ok: false), and a visitor never chooses the id (it comes from the name) nor sponsored. proposalToMarkdown(entry) then writes the entry under its category, the Markdown you read and paste into the directory.

TypeScriptTypeScript
import { proposalToMarkdown, submissionToEntry } from "@recit/directory"; const proposal = submissionToEntry(submission.data, { categories: ["Studios", "Venues"], }); if (proposal.ok) await saveForReview(proposalToMarkdown(proposal.entry));

Structured data

The page that recit build writes carries the directory's schema.org data in its head: an ItemList of its entries, in the order of the page. An entry with an address or a location is a Place, written as a calendar writes the place of an event (location=@id gives the same node), with its telephone and e-mail; any other entry is a Thing, with its name, summary, link and image. entriesJsonLd({ format: "directory", directory }) of @recit/directory gives the same document to a site; with pageUrl, an entry without its own link gets its anchor on the page as url.

Commands

CommandWhat it does
recit validate places.md --linkschecks the links (cache .recit/cache/links.json, Retry-After, a redirection to another domain); warnings, errors with --strict
recit geocode places.mdasks the position of each place without geo, one request a second, and writes it into the companion (below)
recit convert places.csv --to directory --columns name=Nom,url=Sitea table to a directory; an unmapped column is left aside with a warning, never guessed
recit convert places.md --to csvthe directory as a table, a closed set of columns
recit convert places.md --to deckone slide per entry, or --per section
recit convert places.md --to webstoryone card per entry, its link as the call to action, or --per section
recit convert places.mdthe JSON twin, and back from places.json
recit dev places.md, recit build places.mdthe directory as a page, served while you write or built to static files
recit export places.md --to pdf -o places.pdfevery entry, unfiltered, as a list, A4 portrait with its page numbers

The PDF prints every entry, with no filter and no map: pdf: { view: "table" } (front matter, or directory: { pdf: … } in recit.config) prints them as a table, cards as cards. The pdf key takes the PDF options of every paginated format (page, header, footer, colorMode, output…); the file lands next to the story unless -o or pdf.output names it, and is listed in exports.json.

Positions from an address

recit geocode places.md is the only geocoding of Récit, for directories and maps alike. It runs on your machine when you ask, never at build or render time. For each entry with a place and no geo, it asks a Nominatim service for the street, postcode, city, region and country (or the free address when there is none of the first three), and writes the answer into the kind: "sidecar" companion places.json, as the entry's place with its geo. The Markdown is never rewritten: read the companion, and write geo=lat,lon in the entry's braces when you prefer a position of your own, which the command then leaves alone.

  • The rules of the public Nominatim hold for every service: one request a second at most, an identifiable User-Agent, answers kept for 90 days in .recit/cache/geocode.json (--max-age), and no request for an entry whose companion already holds a position for the same address. Change an address in the Markdown and run the command again: that entry alone is asked again.
  • The service is yours to choose: --endpoint points at your own Nominatim or a hosted one (LocationIQ and others speak the same API); --key-env NAME reads its key from the environment, never from a file; --email gives the public Nominatim a contact for more than a few requests.
  • --dry-run lists what would be asked and sends nothing. An address not found is a warning that names the entry, an error with --strict.
  • The credit: positions from the public Nominatim are OpenStreetMap data, under the ODbL. The command prints the line to show on the published site: « Data © OpenStreetMap contributors, ODbL 1.0 ».

Bridges

WhereWhat it gives
::directory{src=./places.md category=studios limit=6} on a slidea few entries as cards
data: { places: ./places.md } in a reportone row per entry: :value{data=places agg=count where="section=studios"}
a calendar with places: ./places.mdlocation=@dolor-hall takes the entry's name and place
MCP search_directoryentries filtered by text, category, tag, city or country

The JSON twin

A kind: "story" file (https://recit.dev/schema/v1/directory.json, format: "directory", version: 1) next to the .md holds the same directory under the story envelope (syntax, preamble, meta, data, settings — see Scenes › In the JSON twin) and scenes, while a kind: "sidecar" companion (places.json) completes scenes and entries by id.

KeyType / valuesEffect
scenesobject[]Required in kind: "story". Sections of the directory, in order (--- separators in Markdown).
scenes.idstring (non-empty)Required. Stable section identifier across languages (--- id=… in Markdown; Scenes).
scenes.titlestring or Record<string, string>Optional section heading (# Heading at the start of the section).
scenes.bodystring or Record<string, string>Optional Markdown or MDX prose of the section before its entries (Scenes).
scenes.notesstring or Record<string, string>Optional author notes in Markdown (:::notes; Scenes).
scenes.attrsRecord<string, string | number | boolean>Optional separator attributes (--- key=value) other than id (Scenes).
scenes.entriesobject[]Optional list of directory entries in this section.

Each object in scenes.entries describes one listed site, place or organization (entries.id and entries.name are required in kind: "story"):

KeyType / valuesEffect
entries.idstring (^[a-z0-9][\w-]*$)Required. Stable entry id (anchor, sidecar key and @id location reference); derived from entries.name in Markdown unless {id=…} is set (required in strict).
entries.namestring or Record<string, string>Required. Display name of the entry ([Name](url) or item title before - in Markdown).
entries.aliasesstring[] (non-empty) or Record<string, string[]>Alternative names ({aliases=a,b} in Markdown); claiming a name or alias already used by another entry is an error.
entries.summarystring or Record<string, string>One-line Markdown summary written after - on the list item.
entries.bodystring or Record<string, string>Long Markdown record of the entry (:::entry{id=…} block in Markdown).
entries.categorystring (non-empty)Category of the entry (## Heading above it or {category=…}), used for grouping and the category facet.
entries.urlstring (http: or https: URI)External link of [Name](url); omitting it warns (directory-link-url) when entries is "links".
entries.tagsstring[] (non-empty)Tags ({tags=a,b} in Markdown), used by the tags facet (?tag=…) and text search.
entries.seestring[] (non-empty)Ids of related entries in the same directory ({see=id,id} in Markdown; an unknown id is an error).
entries.emailstring (email)Contact email address ({email=…} in Markdown).
entries.phonestring (non-empty)Contact phone number ({phone=…} in Markdown).
entries.placeobjectPhysical location of the entry (its fields other than place.name sit flat in {…} in Markdown), also resolved by location=@id in a calendar.
place.namestring or Record<string, string>Optional localized place name; falls back to entries.name when referenced as @id.
place.addressstringFree-text address ({address="…"}), shown as it is and never parsed into structured postal fields.
place.streetstringStreet address ({street="…"}).
place.citystringCity or locality ({city=…}), used by the city facet.
place.postcodestringPostal code ({postcode=…}).
place.regionstringRegion, state or administrative area ({region=…}).
place.countrystring (^[A-Z]{2}$)ISO 3166-1 alpha-2 country code ({country=FR}), formatted in the page's language (Intl.DisplayNames) and used by the country facet.
place.geo[number, number] ([-90, 90], [-180, 180])[latitude, longitude] coordinates ({geo=lat,lng} in Markdown).
entries.sameAsstring[] (http: or https: URIs)Additional external URLs of the entry ({sameAs=url,url} in Markdown).
entries.imagestring (non-empty)Local image path ({image=…} in Markdown), never fetched from the listed site.
entries.source{ url, license? }Provenance of the entry ({source=… license=…} in Markdown; license without source is an error).
source.urlstring (http: or https: URI)Required when entries.source is set. Source URL ({source=…} in Markdown).
source.licensestring (non-empty)Optional license identifier or name ({license=…} in Markdown).
entries.sponsoredbooleanShows a visible "Sponsored" mention and adds rel="sponsored" on the link ({sponsored} in Markdown).
entries.linkStatus"ok" | "redirected" | "broken" | "unreachable"Result of recit validate --links, written in the kind: "sidecar" companion (never in Markdown); "redirected", "broken" and "unreachable" show "to check".
entries.checkedAtstring (ISO 8601 date-time with offset)Timestamp of the last link check, written in the companion by recit validate --links.
entries.finalUrlstring (http: or https: URI)Final URL reached after redirects during recit validate --links, written in the companion.