Skip to content

Fix broken contract link on static about page#116

Open
kosarko wants to merge 3 commits intoclarin-v7from
contract_link
Open

Fix broken contract link on static about page#116
kosarko wants to merge 3 commits intoclarin-v7from
contract_link

Conversation

@kosarko
Copy link
Member

@kosarko kosarko commented Mar 20, 2026

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:

  • Refactored the processLinks method 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 unused no_static_ prefix logic.
  • Added a helper function in the test suite to simulate link click events, including support for nested elements, and introduced comprehensive tests covering all major link handling scenarios (standard, licenses, relative, fragment, and nested). [1] [2]
  • Updated the test environment configuration to use the correct nameSpace property, matching the main application configuration.

Content updates in static HTML files:

  • Updated all references to the old no_static_licenses link in both English and Czech static HTML files to the correct licenses link, ensuring users are directed to the right page for license information. [1] [2] [3] [4] [5] [6]

Code cleanup:

  • Removed the unused static property no_static_ from StaticPageComponent.

Problem description

  1. 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://DOMAIN/static/contract (but when I hover over the link I see the correct https://DOMAIN/repository/contract).
  2. The no_static_ links don't work without javascript

kosarko added 3 commits March 20, 2026 11:17
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
@kosarko kosarko requested a review from amadulhaxxani March 20, 2026 10:25
@kosarko
Copy link
Member Author

kosarko commented Mar 20, 2026

@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 static/ as a part of the relative links?

And similarly for the fragments?

Copy link

@amadulhaxxani amadulhaxxani left a comment

Choose a reason for hiding this comment

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

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/

@kosarko
Copy link
Member Author

kosarko commented Mar 20, 2026

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 static/ prefix where we actually mean static pages (omitting it for licenses, contract), providing static and the page name for same page sections?. Now the question is what would this fix do to the version with js, do we still need any special handling then?

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