A link describes a link between two documents A and B, where A is linking at B. Links are stores in a JSONB attribute inside posts.
[x] Create Pants::Link model, with polymorphic source and target attributes.
[x] When creating or updating a local document, populate link data by parsing the rendered HTML for A tags.
[x] When target is local?, don't create new documents in the database.
[x] When fetching a remote document via anything other than pants-document, populate link data by parsing the fetched HTML for A tags.
Later:
[x] When populating, create/update links; then only destroy those that are gone. (Instead of wiping all links first only to re-create most of them after that.)
[x] Don't fetch remote documents in-line; we'll want to do this asynchronously. Maybe the entire link population should run in an extra thread?
[x] If target is remote?, send a webmention and discard the link. (We only need to store links to local documents.)
A link describes a link between two documents A and B, where A is linking at B. Links are stores in a JSONB attribute inside posts.
Pants::Link
model, with polymorphicsource
andtarget
attributes.target
islocal?
, don't create new documents in the database.Later:
target
isremote?
, send a webmention and discard the link. (We only need to store links to local documents.)