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

Absolute url vs relative url #543

Closed
svrooij opened this issue Jan 19, 2021 · 8 comments
Closed

Absolute url vs relative url #543

svrooij opened this issue Jan 19, 2021 · 8 comments
Labels

Comments

@svrooij
Copy link

svrooij commented Jan 19, 2021

Describe the bug

The menu items have the | absolute_url instruction after the url. This makes them (you guessed it) absolute. For this to work you also need to set the url in the config file. Since jekyll is perfectly capable of generating the correct urls, I would hope for a way to disable the absolute url part (config) or to completely remove it.

Apparently this also exists in the table of content with child pages.

https://github.com/pmarsceill/just-the-docs/blob/e8424986370bef104e680e1443a83e475d2fead7/_includes/nav.html#L67

To Reproduce

Publish any website with just-the-docs.

Expected behavior

I would expect that the url would just be relative. That means that if I want to publish it to a different domain (eg. netlify) the links in the menu would still work. Without me needing to change url.

Screenshots

image

Additional context

At this page the menu links are absolute while the links in the page are relative (and just work).

@pdmosses
Copy link
Contributor

@svrooij thanks for the bug report and PR #544.

In fact this issue should have been fixed in v0.3.2: the release notes refer to #359, which replaced absolute_url by relative_url in _includes/head.html, _includes/nav.html, and lib/tasks/search.rake. However, it appears that the changes to _includes/nav.html in PR #411 conflicted with those in #359, and I must have overlooked that when #411 was merged into v0.3.2.

@svrooij
Copy link
Author

svrooij commented Jan 19, 2021

I saw the v0.3.2 release notes, then spend some time getting it to work. Failed horrible. Than checked the code in master and found that it still had a lot of absolute_url.

The PR replaces them once more.

@ygd
Copy link

ygd commented Jan 22, 2021

@svrooij thank you for this

@svrooij
Copy link
Author

svrooij commented Feb 10, 2021

Until it is fixed in this repo, you can use remote_theme: svrooij/just-the-docs@relative-everything in your _config.yml like I do here:

https://github.com/svrooij/node-sonos-ts/blob/27c49b6249c5f0cf2fca17d03f10508f62c604f1/docs/_config.yml#L30

@ygd
Copy link

ygd commented Feb 16, 2021

Until it is fixed in this repo, you can use remote_theme: svrooij/just-the-docs@relative-everything in your _config.yml like I do here:

https://github.com/svrooij/node-sonos-ts/blob/27c49b6249c5f0cf2fca17d03f10508f62c604f1/docs/_config.yml#L30

or just overwrite the files locally ...

@svrooij
Copy link
Author

svrooij commented Feb 16, 2021

Locally overriding the files works great, but I found one part that I couldn't override (I think it was the side menu). That is why I also forked the repo with a solution that works without any big changes to your project.

@MichaelCurrin
Copy link

Thanks! I came here looking for this issue and found, as the absolute URLs are surprising when navigating on a local site.

I approved #544

@pdmosses pdmosses mentioned this issue Apr 20, 2022
pdmosses added a commit to pdmosses/just-the-docs that referenced this issue Jun 27, 2022
Replace all uses of `absolute_url` by `relative_url`.

Co-authored-by: Stephan van Rooij <1292510+svrooij@users.noreply.github.com>

@svrooij I hope this finally fixes issue just-the-docs#543, and subsumes your closed just-the-docs#544. I used `Find in Project` (in Atom) to replace all 11 occurrences of `absolute_url`.
simonebortolin added a commit to simonebortolin/just-the-docs that referenced this issue Aug 6, 2022
@svrooij I hope this finally fixes issue just-the-docs#543, and subsumes your closed just-the-docs#544. I used `Find in Project` (in Atom) to replace all 11 occurrences of `absolute_url`.
@pdmosses
Copy link
Contributor

This issue should (finally) be fixed in v0.4.0.rc1.

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 a pull request may close this issue.

4 participants