Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix relative links #442

Merged
merged 7 commits into from
Feb 10, 2025
Merged

Fix relative links #442

merged 7 commits into from
Feb 10, 2025

Conversation

reakaleek
Copy link
Member

@reakaleek reakaleek commented Feb 6, 2025

Context

In #436 (comment) we discovered an unexpected behaviour of relative links. (unexpected but correct behaviour)

TL;DR

If you are on a page with relative links, your link resolves to something different depending if the current path has a trailing slash or not.

Reproduce

  1. Go to https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/436
  2. Click on the first link "Contribute to Elastic documentation"
  3. It leads to a non existing link.
  1. Go to https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/436/ (trailing slash)
  2. Click on the first link "Contribute to Elastic documentation"
  3. It works

Changes

  • This transforms every relative path to a root-relative path (starting with /) to avoid the problem of relative links.
  • Also, it's sets /docs as url path prefix in tests as this resembles production.

How to test

  1. Go to https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/442
  2. Click on the first link "Contribute to Elastic documentation"

@reakaleek reakaleek closed this Feb 6, 2025
@reakaleek reakaleek deleted the feature/fix-relative-links branch February 6, 2025 21:28
@reakaleek reakaleek reopened this Feb 6, 2025
@reakaleek reakaleek added the fix label Feb 6, 2025
@reakaleek reakaleek enabled auto-merge (squash) February 10, 2025 12:50
@reakaleek reakaleek merged commit 792cf01 into main Feb 10, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants