Relatude Help

18.2 Links inside HTML and Markdown

A link in a rich-text field must survive a rename of the page it points at. So properties marked StringValueType.HTML or Markdown ([HtmlProperty] is the short form) store links in an id-based form, never as public URLs:

<!-- what is stored -->
<p>Read about the <a href="rdb:nARQvAABE">Sony X90</a>.</p>

<!-- what every read returns -->
<p>Read about the <a href="/tv/sony-x90/info">Sony X90</a>.</p>

This happens by itself, on every write and every read, in HTML inside embedded nodes too. A token whose target is deleted reads as href="#", and the stored value keeps the token.

  • Pages, files and file variants become tokens. A variant's adjustment goes into the token.
  • Only this site's URLs are resolved: paths from the root (/tv/sony-x90), and URLs whose host is the site's (a domain's host, the host of an absolute base address, or one in OwnHosts). Another site's URL stays as written, even if its path matches a page here. So does a relative path (info), as the store does not know which page the value is on, and so do anchors, mailto: and tel:.
  • The query and fragment are kept: /tv/sony-x90?tab=specs#reviews is stored as the token followed by ?tab=specs#reviews. A file's query is part of its address, so only its fragment is kept (#page=3).

For content you handle yourself, db.ExternalizeContentLinks(html) turns tokens into URLs and db.InternalizeContentLinks(html) turns URLs into tokens. An editor can also work with tokens directly:

string pageLink = db.GetContentLink(venue.Id);   // "rdb:…", to use as an href
string picture  = db.GetContentLink(venue.Photo.PropertyPath!, new FileAdjustmentImage { Width = 800 });
if (db.TryParseContentLink(pageLink, out var target)) { … }   // what a token points at