Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make all links relative to the root catalog #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mojodna
Copy link
Contributor

@mojodna mojodna commented Feb 25, 2019

Motivation: allow relative links to be easily resolved without traversing up a catalog tree and to provide information on the catalog structure within a single document that would otherwise have to be determined by reading multiple documents.

Introduce href:from to indicate the path from the root to the current document.

At this point, self becomes the filename and duplicates the filename portion of href:from, so that may indicate an additional direction.

The only absolute URL in this catalog is now the root catalog's self. That, too, could be removed and stashed in a sidecar file to be used for resolution.

Inclusion of the path from a root document (rel=root), allows knowledge of the root document’s URI to be used to resolve relative links in child documents. The root document’s rel=self can be absolute or it can be provided externally, allowing all links in a catalog to be relative (including rel=self).

href:from is a proposal with no prior art; HTML 4’s rev attribute comes close to describing this relationship, but isn’t quite right (and was dropped in HTML5). It also duplicates rel=self, potentially suggested an alternative link role (to self) where the href is the path from the root document. (This breaks link crawlers, as href is expected to be relative from the current document, rather than from another.)

Refs radiantearth/stac-spec#401

{
"rel": "collection",
"href": "../../catalog.json"
"href": "../../collections/planet-collection.json",
"href:from": "../hurricane-harvey/0831/Houston-East-20170831-103f-100d-0f4f-RGB.json"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mojodna this should be hurricane-harvey/0831/..., right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is right. From collections/, the reverse link needs to go up a level to descend a different sibling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants