Repository navigation
Description
In Orbit's docs, referring to another document means finding it, copying its URL, and pasting a link. Nothing tells you afterwards that the link exists. Open a document and there is no way to know what else in the workspace points at it.
Backlinks are what make a wiki different from a folder of files. Without them, a document that nobody bookmarked is a document nobody will find again.
What to build
Link autocomplete in the editor. Typing a trigger, [[ or @, opens a picker of documents in the workspace, filtered as you type, and inserts a real reference rather than a URL string. The reference stores the doc id, so renaming the target does not break the link and the link text can follow the target's title.
A backlinks panel. At the bottom of a doc, or in the side panel next to the outline: every document that references this one, with the surrounding sentence for context. This is the half that delivers the value. Autocomplete on its own is a convenience; backlinks change how people find things.
Broken link handling. When a linked doc is archived or deleted, the link should render as clearly broken rather than as a dead click. When it is restored, the link works again.
Implementation notes
Store links as rows, not by parsing on read. A doc_link table joining source doc to target doc, written when a document is saved. Parsing every document's body to answer "what links here" does not scale and cannot be indexed. The table wants a unique index on source and target and an index on target for the backlinks query.
Access control on the backlinks panel. This is the part that is easy to get wrong and it is a real leak if you do. doc_access in packages/db/src/schema/content.ts grants per subject, and doc.visibility narrows further. Somebody looking at a public document must only see backlinks from documents they may read. Otherwise the panel leaks the existence and titles of private documents to anyone with the share link. Filter the backlink query by the reader's access, not by the target document's.
Published docs. publish_token makes a doc publicly readable at /d/[token]. Backlinks on a published page must show only other published documents, if any at all. Decide and say which.
The editor. TipTap 3, extensions live in apps/web/src/features/docs/editor/extensions.ts. A mention style node with a suggestion plugin is the standard shape. There is already an anchor plugin in that directory, so there is a precedent for a custom node.
Markdown round trip. Docs import and export markdown, via doc-import.tsx, doc-export-menu.tsx and markdown.ts. Decide how a wiki link serialises on export and how it parses on import. A link that survives an export and re-import is worth more than a clever syntax that does not.
Related
Mentioning an issue or a person inline is a sibling issue in this milestone and shares the suggestion plugin infrastructure. If both are picked up, coordinate on this thread.
Files
apps/web/src/features/docs/editor/extensions.tsapps/web/src/features/docs/editor/rich-text-editor.tsxpackages/db/src/schema/content.tspackages/core/src/content/apps/web/src/features/docs/doc-outline.tsxfor where a panel could live
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsBacklog
Activity
imshashank commentedon Aug 8, 2026
Shares infrastructure with #204, so coordinate before starting.
Both issues need a TipTap suggestion plugin on the same editor: this one for documents, #204 for issues, docs and people. Build it once and generically. Whoever starts first should say so on both threads.
Both also share the same permission trap, which is the part worth the most care: a backlinks panel and an inline chip can each leak the existence and title of something the reader may not see. The rule is the same in both, filter by the reader access rather than by the target visibility.
imshashank commentedon Aug 15, 2026
Half of this shipped. Re-scoping to the half that did not.
Done: the backlinks panel.
packages/core/src/content/doc-service.tshaslistDocBacklinks, capped atDOC_BACKLINK_LIMIT = 50, and it is attached to every doc throughdetailFor, soDocDetail.backlinksis part of the payload. It is rendered indoc-reader.tsxanddoc-surface.tsx, and it is covered by tests inpackages/core/tests/content/doc-service.test.tsandapps/web/tests/features/docs/. It respectsdocReadFilter, so a backlink from a document you cannot read does not appear, which is the part that would have been easy to get wrong.Not done: wiki links. There is no
[[...]]syntax. Nothing inapps/web/src/features/docs/editor/markdown.tsorcommands.tsparses one, and grepping the repository for a wikilink node returns nothing.Worth knowing before picking this up. The backlinks panel is built on a URL match, not on links:
That has two consequences for the remaining work:
/docs/<id>URL. A[[Title]]wiki link would not be found by it, so adding wiki link syntax means extending or replacing this query, not just adding a parser.doc.contentper document view, unindexed. It is fine at current scale and it will not stay fine. If wiki links land, this is the moment to store links in a real table instead, which also makes "what does this link to" answerable rather than only "what links here".Revised scope. Wiki link syntax, resolution by title with an id fallback, an autocomplete on
[[, and a link store that both the wiki links and the existing backlinks panel read from. The panel UI itself is done and should be kept.Related: #204, which wants inline mentions of docs and issues with a live render. That and this issue should probably share the link store rather than each building their own resolution path.
imshashank commentedon Sep 6, 2026
Backlinks shipped. The remaining half (a
[[link, resolution by title, and a real link store) now lives in #204 so there is one link-store issue instead of two. Closing this one.