HomePhabricator

Fix Diviner links to articles by title

Description

Fix Diviner links to articles by title

Summary:
Ref T988. This fixes the biggest current problem with Diviner, which is dead links to articles.

In the new Diviner, articles can have both a "name" (derived from the file name, and used in the URI) and a "title" (optional, specified explicitly). For example, we have one document with the name "feedback" and the title "Give Feedback! Get Support!".

On disk, we want to use the name for the actual file where the text lives ("feedback.diviner"). We also want to use the name in the URI, to generate a clean URI and to allow us to retitle the document slightly without breaking links to it (for example, we renamed the "Backup" document to "Backups and Migrations").

However, when displaying the article we want to use the title.

Currently, you can only link to the name, not the title. This is inconvenient:

  • We have a bunch of existing docs which link to titles.
  • It's natural/intuitive to link to titles.
  • Linking to titles makes it easier/cheaper to generate documentation, because we don't need to be able to resolve things at render time.

To remedy this, allow links to target either names or titles. If we miss on a name query, we'll do a title query. This is implemented with a slug hash to allow approximately correct titles (wrong case/spacing/punctuation, e.g.) and sidestep all the UTF8/column length issues.

(In the long run, atom resolution should theoretically be more sophistiated than it is now, and we should do render-time lookups on at least some documents to catch bad links. However, this is fairly complicated and a relatively advanced feature, and I think allowing links to titles is desirable no matter what.)

Test Plan: The user documentation book now has valid links to articles when the titles and names differ.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T988

Differential Revision: https://secure.phabricator.com/D8407

Details

Provenance
epriestleyAuthored on
epriestleyPushed on Mar 5 2014, 8:07 PM
Reviewer
btrahan
Differential Revision
D8407: Fix Diviner links to articles by title
Parents
rP2ceffadee78a: Support Herald rules for new Differential edits
Branches
Unknown
Tags
Unknown
Tasks
T988: Make Diviner a first-class application

Event Timeline