Search, agents and dates
View as MarkdownSearch #
Open search from the sidebar, or press Ctrl K (⌘ K on a Mac).
- The build writes
search-index.json, with one entry perh2andh3section and one for each page's opening text. - The client loads MiniSearch and the index on first use, so pages load none of it up front.
- An empty search lists the last five pages you opened, then the current
page's
h2andh3sections. The browser keeps the visited pages inlocalStorage, per site. - Every word of the query must match. Words match by prefix; words of five letters or more also allow typos.
- The index holds only each example's output, not its source, so a word in an example matches once.
Client #
startDocs() from @memomori-app/elysium/client is the browser script. The
CLI's theme runs it for you. It:
- keeps the sidebar's scroll position between pages
- marks the current section in "On this page"
- turns to the previous or next page on ← and →
- opens search on Ctrl K
- runs the copy button on each code block
The arrow keys scroll a code block or table that scrolls sideways instead of
turning the page, and do nothing while you select text. Pass
{ arrowKeys: false } or { searchKey: false } to turn off either key.
A button with a data-copy attribute copies that text, so you can place
copy buttons of your own:
<button data-copy="npm install @memomori-app/elysium">Copy</button>
For agents and crawlers #
llms.txtlists every page by section, each with its description and a link to its Markdown copy.llms-full.txtholds every Markdown copy in one file.- Each page has a Markdown copy at its URL plus
.md, linked from the page asrel="alternate"and from its "View as Markdown" button. Anexamplefence there reads as a plainmdfence. sitemap.xmllists every page with itslastmod, when you set a site URL. Add it to yourrobots.txt.
Last updated #
{{.updated}} and lastmod come from the last git commit that touched the
page's file. A page git has not seen gets neither. A build without git
history, such as a shallow clone in CI, shows the wrong date or none; fetch the
full history before you build.
createDocs takes an updated option to date pages another way. It gets each
page's path inside the folder and returns a YYYY-MM-DD date, or undefined
for none, and Elysium then never runs git.