fix(techdocsStorageClient): properly construct baseUrls #8365
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.
Signed-off-by: Phil Kuang pkuang@factset.com
Hey, I just made a Pull Request!
Context: mkdocs/mkdocs#2456
We have some docs with the older style of relative links as shown in the linked issue above.
eg.
[linking to other page](../foo-bar)
which loads/docs/default/Component/my-component/foo-bar
(note the missing trailing slash)Looking into the TechDocs reader, this is inherently supported when attempting to load the raw docs html and inspecting the network requests, it is being fetched correctly since the trailing slash is added appropriately:
backstage/plugins/techdocs/src/client.ts
Lines 162 to 174 in a173851
The issue arises when updating links that load additional assets:
backstage/plugins/techdocs/src/reader/transformers/addBaseUrl.ts
Lines 60 to 64 in a173851
eg. a
<link href="../extra.css">
is incorrectly transformed to<link href="<app-origin>/static/docs/default/Component/extra.css" />
This change fixes the URL transformation to ensure a trailing slash so that the asset path is resolved correctly eg.
<link href="<app-origin>/static/docs/default/Component/my-component/extra.css" />
✔️ Checklist
Signed-off-by
line in the message. (more info)