Directory
Available format: 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) -). The same file is shown as cards, a list or a table, filtered by
category, tag, city and country in the URL (?category=, shareable), and, with
pages: true, a page per entry.
The example is directory- (a raw awesome list, no braces). The
glossary shares the same model of entries.
A minimal directory
places.md
In the {…} of an entry | What it is |
|---|---|
id | default: the slug of the name |
tags | comma-separated |
email, phone, image | contact; image is a local file, never fetched from the site |
street, city, postcode, region, country, geo | the place: country in ISO 3166 (FR), geo as lat,lng |
address | free text, shown as it is, never parsed |
sponsored | a visible mention and rel= |
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.).
Settings
In the front matter, or for every directory of a folder in the directory: section of
recit. (the front matter wins).
| Setting | Default | What it does |
|---|---|---|
entries | links | what one entry is: links, places or organizations |
view | cards | the view shown first: cards, list, table or map (the map needs the maps package) |
pages | false | one page per entry |
facets | [category, tags] | the filters offered, in order, in the URL: category, tags, city, country |
strict | false | every entry writes its {id=…}; an entry without one is an error |
pdf | A4 portrait, a list | recit export --: view (list, table or cards), the page box |
With strict: true (front matter, or directory: 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:, Lorem Studio (places.md:14),
Ipsum Lab (✖ places.) and Dolor Hall
(places.md:21). A :::entry{id= block does not count: the id goes in the {…} of the item,
{id=. A companion file that completes an entry (the
linkStatus of recit validate --) leaves the rule as it is. This is not --strict of
recit validate --, which turns broken links into errors.
recit.config.ts
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. 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.
places.md
A React component that embeds Directory (@recit/) can provide its map
through the renderMap(markers) prop (view: "map" falls back to cards without it);
entryMarkers(entries) from @recit/ 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/ 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.
TypeScript
Where the submission arrives (onSubmit of createFormHandler in @recit/),
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.
TypeScript
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: of @recit/ gives the same document to
a site; with pageUrl, an entry without its own link gets its anchor on the page as url.
Commands
| Command | What it does |
|---|---|
recit validate places. | checks the links (cache .recit/, Retry-After, a redirection to another domain); warnings, errors with --strict |
recit geocode places.md | asks the position of each place without geo, one request a second, and writes it into the companion (below) |
recit convert places. | a table to a directory; an unmapped column is left aside with a warning, never guessed |
recit convert places. | the directory as a table, a closed set of columns |
recit convert places. | one slide per entry, or --per section |
recit convert places. | one card per entry, its link as the call to action, or --per section |
recit convert places.md | the JSON twin, and back from places.json |
recit dev places.md, recit build places.md | the directory as a page, served while you write or built to static files |
recit export places. | every entry, unfiltered, as a list, A4 portrait with its page numbers |
The PDF prints every entry, with no filter and no map: pdf: (front matter, or
directory: 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: 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:
--endpointpoints at your own Nominatim or a hosted one (LocationIQ and others speak the same API);--key-reads its key from the environment, never from a file;env NAME --emailgives the public Nominatim a contact for more than a few requests. --dry-runlists 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
| Where | What it gives |
|---|---|
::directory{src=./ on a slide | a few entries as cards |
data: in a report | one row per entry: :value{data= |
a calendar with places: | location=@ takes the entry's name and place |
MCP search_ | entries filtered by text, category, tag, city or country |
The JSON twin
A kind: file (https://, format:,
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: companion (places.json) completes scenes and entries by id.
| Key | Type / values | Effect |
|---|---|---|
scenes | object[] | Required in kind:. Sections of the directory, in order (--- separators in Markdown). |
scenes.id | string (non-empty) | Required. Stable section identifier across languages (--- id=… in Markdown; Scenes). |
scenes.title | string or Record<string, string> | Optional section heading (# Heading at the start of the section). |
scenes.body | string or Record<string, string> | Optional Markdown or MDX prose of the section before its entries (Scenes). |
scenes.notes | string or Record<string, string> | Optional author notes in Markdown (:::notes; Scenes). |
scenes.attrs | Record<string, string | number | boolean> | Optional separator attributes (--- key=) other than id (Scenes). |
scenes. | object[] | Optional list of directory entries in this section. |
Each object in scenes. describes one listed site, place or organization (entries.id and
entries.name are required in kind:):
| Key | Type / values | Effect |
|---|---|---|
entries.id | string (^[a-) | 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.name | string or Record<string, string> | Required. Display name of the entry ([Name](url) or item title before - in Markdown). |
entries. | string[] (non-empty) or Record<string, string[]> | Alternative names ({aliases= in Markdown); claiming a name or alias already used by another entry is an error. |
entries. | string or Record<string, string> | One-line Markdown summary written after - on the list item. |
entries.body | string or Record<string, string> | Long Markdown record of the entry (:::entry{id= block in Markdown). |
entries. | string (non-empty) | Category of the entry (## Heading above it or {category=…}), used for grouping and the category facet. |
entries.url | string (http: or https: URI) | External link of [Name](url); omitting it warns (directory-) when entries is "links". |
entries.tags | string[] (non-empty) | Tags ({tags=a,b} in Markdown), used by the tags facet (?tag=…) and text search. |
entries.see | string[] (non-empty) | Ids of related entries in the same directory ({see=id,id} in Markdown; an unknown id is an error). |
entries. | string (email) | Contact email address ({email=…} in Markdown). |
entries. | string (non-empty) | Contact phone number ({phone=…} in Markdown). |
entries. | object | Physical location of the entry (its fields other than place.name sit flat in {…} in Markdown), also resolved by location=@id in a calendar. |
place.name | string or Record<string, string> | Optional localized place name; falls back to entries.name when referenced as @id. |
place. | string | Free-text address ({address=), shown as it is and never parsed into structured postal fields. |
place.street | string | Street address ({street="…"}). |
place.city | string | City or locality ({city=…}), used by the city facet. |
place. | string | Postal code ({postcode=…}). |
place.region | string | Region, state or administrative area ({region=…}). |
place. | string (^[A-Z]{2}$) | ISO 3166-1 alpha-2 country code ({country=FR}), formatted in the page's language (Intl.) and used by the country facet. |
place.geo | [number, number] ([-90, 90], [-180, 180]) | [latitude, longitude] coordinates ({geo= in Markdown). |
entries. | string[] (http: or https: URIs) | Additional external URLs of the entry ({sameAs= in Markdown). |
entries. | string (non-empty) | Local image path ({image=…} in Markdown), never fetched from the listed site. |
entries. | { url, license? | Provenance of the entry ({source= in Markdown; license without source is an error). |
source.url | string (http: or https: URI) | Required when entries. is set. Source URL ({source=…} in Markdown). |
source. | string (non-empty) | Optional license identifier or name ({license=…} in Markdown). |
entries. | boolean | Shows a visible "Sponsored" mention and adds rel= on the link ({sponsored} in Markdown). |
entries. | "ok" | "redirected" | "broken" | "unreachable" | Result of recit validate --, written in the kind: companion (never in Markdown); "redirected", "broken" and "unreachable" show "to check". |
entries. | string (ISO 8601 date-time with offset) | Timestamp of the last link check, written in the companion by recit validate --. |
entries. | string (http: or https: URI) | Final URL reached after redirects during recit validate --, written in the companion. |