Follow links between documents
A reader taps links, mentions, cards and rows to move from one document to the next inside the app, and comes back with Back.

As a reader, I want to tap a link and land on the document it points to, inside the app, so that I can follow a train of thought and find my way back.

Situation

I am reading a document that points to others: links in the text, mentions of people and pages, cards that show another document, lists of documents and buttons.

What I do

    Tap a link in the text, a mention, a card, a row in a list, or a button.

    Read the document that opens.

    Tap Back, or swipe from the left edge, to return one page at a time.

What I should see

    A link to a Hypermedia document opens that document in the app, on top of the one I was reading.

    A mention shows the name of the person or page, not an address, and opens that page. A mention of a person opens their home document.

    A card for an embedded document, a card or row in a list, a row under "In this space" and a button all open their document with one tap.

    A link to a web page of the site I am reading also opens in the app.

    Each opened document has a Back button. Back, or a swipe from the edge, returns to the page before.

    Going back shows the earlier page at once, as I left it, without loading again.

    A link that names a version or a paragraph opens the document from the top, at its latest version.

    Links to other web addresses, email addresses and phone numbers are ordinary links that my phone opens outside the reader.

    Text whose link is not a kind the app can follow safely is shown as plain text.

When something goes wrong

    If the document behind a link cannot be loaded, the page is titled "Document" and shows the reason with "Retry", for example "This document doesn't exist on this server." I tap "Retry", or Back to return to where I was.

    A card whose document cannot be found shows a warning symbol and "This document is not available." The rest of the page still reads normally.

Not included

    A link to a single paragraph does not scroll to it or highlight it (Deep links and URL handling).

    A link to a specific version shows the latest version instead.

    A web link to a different Seed site leaves the app instead of opening in the reader. To read it here I paste it into Open site (Moving between tabs and into the app).

    There is no history list and no Forward.

Trace

Story US-READ-03, status Shipped. These links are kept in step with the traceability matrix and with the "User stories" section of every page listed here.

Design

Page

Part it plays

Document and site home

Every link pushes another copy of this screen; the Actions table

Moving between tabs and into the app

Which links stay in the app and which are left as web links

Stacks, pushes and sheets

Documents are pushed on the Read stack; how Back works

Navigation bars and their actions

Back on every pushed document

Reading another site in place

Links are followed on the site of the page being read

link

The element behind every row, card, button and inline link

DocBlockView

Inline links and mentions in text, button blocks, media rows

DocBlockView: embed and query blocks

Embed cards and query cards and rows as single links

DocCard

A query result card that opens its document

DocItemRow

A document row that opens its document

StatusLine

The failure line when a linked document cannot load

Share, copy and open

When a link leaves the app

Lists

Rows that navigate

Reading first

Following a link costs one tap and no decision

Names, not identifiers

Mentions read as names, not addresses

Implementation

Page

Part it plays

Read: ids, refs and link targets

refFromUrl, linkTarget and docHref: which URLs become in-app locations

Read: blocks to rows and inline Markdown

Link and mention annotations become Markdown links; embed, button and media hrefs

Read: loading pages, caches and embeds

Mention names, redirects, and the caches that make Back instant

Read: screens and components

The link elements in DocBlockView, DocItemRow and DocCard

Read: root contract wiring

readStack, readRefs and the doc route

Read: sources and the refresh epoch

readDocs loads every document on the stack

Deep links and URL handling

The doc route as the one entry point; readScopedHref

Navigation and routes

follow, go, back and the root navigate handler

The root contract (app.contract)

main navigate=follow and navigationBack

Seed site read API

/api/Resource (with redirects) and /api/ResourceMetadata for mention names

Contract views and built-in calls

The link element and navigation attributes

Contract UI tests

read.test.contract push and Back tests

Bun unit tests

deep-links.test.ts, markdown.test.ts and edge-cases.test.ts

Code

File

What

src/read/ids.ts L109-118

linkTarget: hm links and same-site pages stay in the app, the rest is left as is

src/read/ids.ts L17-35

refFromUrl: hm:// and /hm/ gateway URLs become refs, version and fragment dropped

src/read/markdown.ts L158-172

Link and Embed (mention) annotations rendered as Markdown links

src/read/markdown.ts L334-363

Embed, Button and media rows get their href

src/read/load.ts L318-331

Mention names looked up for inline mentions

src/read/load.ts L198-224

fetchDocument: follows redirects, names the failure

app.contract L19-20

readScopedHref

app.contract L277-280

follow and back

app.contract L744-744

main with navigate=follow and navigationBack="back"

read.contract L133-133

DocItemRow is a link to its document

read.contract L208-253

Embed card, query results, button and media links in DocBlockView

Tests

File

What it checks

read.test.contract

a child document pushes and Back returns home

read.test.contract

an embed renders as a card and a query lists documents

read.test.contract

a Card query renders a card grid with face piles

src/read/__tests__/deep-links.test.ts

links to the current server's site stay in the app; other hosts open outside

src/read/__tests__/markdown.test.ts

hyper.media home: paragraphs with in-app links, headings, list markers, a table

src/read/__tests__/markdown.test.ts

an inline mention (Embed annotation) reads its target name

src/read/__tests__/markdown.test.ts

external buttons and videos keep external URLs

src/read/__tests__/edge-cases.test.ts

document links cannot execute active URL schemes

Delivery

Delivered by #1470, #1484.

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime

Connections0
Linked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkLinked document ยท Outgoing linkFollow links between documentsFollow links between docuโ€ฆ
Citations 0Children & links 35

Loading child documentsโ€ฆ

Connections show where other documents or comments link to this document.

Related documents

Loading connectionsโ€ฆ