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

Use relative paths for redirects #19

Merged
merged 1 commit into from
Apr 23, 2021

Conversation

plannigan
Copy link
Contributor

Changes the path assigned to location.href to be relative to old html page.

The PR adds pytest test cases to verify the produced paths.

You can also see the output in action. These are the configured redirects.

Using relative paths:
Fixes #17 (Local file redirects)
Fixes jimporter/mike#35 (Site hosted in a sub-directory without depending on a static site_url from the mkdocs config)

@plannigan
Copy link
Contributor Author

@burkestar @zhimsel Would it be possible to get a review of these changes?

@zhimsel
Copy link
Contributor

zhimsel commented Feb 15, 2021

I no longer have write access to the repo as I no longer work at DataRobot.

prcr pushed a commit to codacy/docs that referenced this pull request Apr 23, 2021
See mkdocs/mkdocs-redirects#19 for a
solution to fix the absolute redirects that cause redirects in
Codacy Self-hosted versions to navigate back to the Latest version
of the documentation.
Copy link
Contributor

@prcr prcr left a comment

Choose a reason for hiding this comment

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

I ran into the same issue of mkdocs-redirects not being compatible with mike.

Right now I'm already using the solution from this pull request in production:

codacy/docs@4ee1d2e

Here are the resulting changes to the redirect pages:

codacy/docs@fc03c3b

And here's the an example URL that correctly redirects to the target page:

https://docs.codacy.com/v2.0.387-deprecated/hc/en-us/articles/207278449/

@prcr
Copy link
Contributor

prcr commented Apr 23, 2021

@burkestar, how can we work to have these changes merged into the original project?

@burkestar
Copy link
Collaborator

Thanks @plannigan for the contribution here, and @prcr for the reminder.

I'll get this released to PyPI today. Needs a changelog update and possibly a few other tweaks to get it ready. Sorry for the long delay!

@burkestar burkestar merged commit c054401 into mkdocs:master Apr 23, 2021
@burkestar
Copy link
Collaborator

Released as 1.0.2

prcr pushed a commit to codacy/docs that referenced this pull request Apr 24, 2021
@prcr
Copy link
Contributor

prcr commented Apr 24, 2021

Thanks for the quick reply @burkestar! 👍

I began doing a full rollout of the new version of the plugin to production but came across an issue in the specific scenario of having a redirect target index.md (as I'm doing to redirect a few deleted pages to the documentation homepage). I proposed a simple fix on #21.

prcr pushed a commit to codacy/docs that referenced this pull request Apr 29, 2021
* bump: Update mkdocs-redirects to 1.0.2

Fixes redirects with absolute links:
mkdocs/mkdocs-redirects#19

* bump: Update mkdocs-redirects to 1.0.3
@plannigan plannigan deleted the relative_redirects branch August 1, 2021 19:39
oprypin pushed a commit that referenced this pull request Mar 29, 2022
Resolves the regression of `README.md` handling introduced by #19.

* Add more test cases.
* Removes `ext` variable that wasn't being used.
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.

Compatibility with mkdocs-redirects Redirects don't work locally
4 participants