This change across several files allows to serve a catalog e.g. from http://localhost:8000/subdir/mycatalog with the mycatalog directory containing all necessary components of the catalog, such as assets, metadata, etc. The changes involved:
using the <base> html tag in the index.html file and assigning its href property dynamically based on window.location.path
changing all paths of assets and scripts, previously all absolute (starting with /) to relative paths, that will now be interpreted as relative to the <base> tag href property
changing the router base property to also be assigned dynamically from window.location.path
updating the catalog-serve command and Webcatalog.serve() method to accept an optional base argument which allows a local server to serve the base path as root, and then use the relative portion of the catalog location relative to the base path in order to set the correct redirect configuration. Previously, the redirect rule from /dataset to /index.html basically assumed that the base path and catalog location were the same. Now the redirect rule uses the relative portion to redirect from /{relpath}/dataset to /{relpath}/index.html.
The last point implies that any server using a catalog location that is different from and relative to the base path will have to change their redirect rules to accommodate the relative portion.
Lastly, some metadata that was found to be faulty during testing was updated.
This aims to address https://github.com/datalad/datalad-catalog/issues/443
This change across several files allows to serve a catalog e.g. from
http://localhost:8000/subdir/mycatalog
with themycatalog
directory containing all necessary components of the catalog, such as assets, metadata, etc. The changes involved:<base>
html tag in theindex.html
file and assigning its href property dynamically based onwindow.location.path
/
) to relative paths, that will now be interpreted as relative to the<base>
taghref
propertybase
property to also be assigned dynamically fromwindow.location.path
catalog-serve
command andWebcatalog.serve()
method to accept an optionalbase
argument which allows a local server to serve the base path as root, and then use the relative portion of the catalog location relative to the base path in order to set the correct redirect configuration. Previously, the redirect rule from/dataset
to/index.html
basically assumed that the base path and catalog location were the same. Now the redirect rule uses the relative portion to redirect from/{relpath}/dataset
to/{relpath}/index.html
.The last point implies that any server using a catalog location that is different from and relative to the base path will have to change their redirect rules to accommodate the relative portion.
Lastly, some metadata that was found to be faulty during testing was updated.