Fix broken contract link on static about page#116
Conversation
There's an issue with the /static/about page. The underlying html is @src/static-files/about.html ; when I click the link `<a id="distribution-link" href="contract">"Distribution License Agreement"</a>` in a browser (links) with disabled js. It works correctly. But in chrome based browsers something interferes. To give a concrete example https://dspace-dev.ufal.mff.cuni.cz/repository/static/about and clicking the link takes me to https://dspace-dev.ufal.mff.cuni.cz/static/contract (but when I hover over the link I see the correct https://dspace-dev.ufal.mff.cuni.cz/repository/contract).
Now all non-fragment, non-dot-relative, non-external links on static pages use the normal app-root internal-link flow
|
@amadulhaxxani seems there's an issue with the "dot relative" links. See the static/about page and Terms of Service link. In js enabled browsers it eventually takes you to the right place (although if you hover over the link it doesn't look like it will). In JS disabled browsers you end up on 404 page. Thoughts? I'm thinking - should we explicitly add And similarly for the fragments? |
amadulhaxxani
left a comment
There was a problem hiding this comment.
I think you’re right to flag it.
I wouldn’t add static/ to everything though.
Maybe:
Use explicit app paths for app pages (like contract, licenses, terms), so they work with and without JS
Keep dot-relative links only for true static-to-static navigation.
For fragments: use #section for same page, and full path + #section for cross Page anchors.
So the fix is mostly about making intent explicit per link type, not globally adding static/
|
I think it's the base element in the html head that "confuses" things. Same page #section seems to resolve to baseurl#section. And similar with the "static" links. We should be able to fix the links when no js is involved, by fixing the relative links - providing |
This pull request improves internal link handling for static pages and updates license-related links in static HTML content. The main changes include refactoring the
StaticPageComponent's link processing logic for greater robustness and consistency, and updating static files to use the correct license link.Improvements to link handling in
StaticPageComponent:processLinksmethod to robustly resolve anchor elements from events, handle nested elements, and consistently build URLs based on the configured namespace. This ensures all internal, relative, and fragment links are handled correctly, and simplifies the code by removing the unusedno_static_prefix logic.nameSpaceproperty, matching the main application configuration.Content updates in static HTML files:
no_static_licenseslink in both English and Czech static HTML files to the correctlicenseslink, ensuring users are directed to the right page for license information. [1] [2] [3] [4] [5] [6]Code cleanup:
no_static_fromStaticPageComponent.Problem description
<a id="distribution-link" href="contract">"Distribution License Agreement"</a>in a browser (links) with disabled js. It works correctly. But in chrome based browsers something interferes. To give a concrete example https://dspace-dev.ufal.mff.cuni.cz/repository/static/about and clicking the link takes me to https://DOMAIN/static/contract (but when I hover over the link I see the correct https://DOMAIN/repository/contract).