Make all links relative to the root catalog #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:fromto indicate the path from the root to the current document.At this point,
selfbecomes the filename and duplicates the filename portion ofhref: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’srel=selfcan be absolute or it can be provided externally, allowing all links in a catalog to be relative (includingrel=self).href:fromis a proposal with no prior art; HTML 4’srevattribute comes close to describing this relationship, but isn’t quite right (and was dropped in HTML5). It also duplicatesrel=self, potentially suggested an alternative link role (toself) where thehrefis the path from the root document. (This breaks link crawlers, ashrefis expected to be relative from the current document, rather than from another.)Refs radiantearth/stac-spec#401