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

optionally fix document when URL are redirected #1433

Open
ccoVeille opened this issue Jun 1, 2024 · 6 comments
Open

optionally fix document when URL are redirected #1433

ccoVeille opened this issue Jun 1, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@ccoVeille
Copy link

ccoVeille commented Jun 1, 2024

--remap feature is great

But it requires to add the source and target domain. So the feature is like what a "search and replace" would do.

I would like to see something that uses the power of lychee, and we could consider it would remap the URL in the document by replacing with the place they are redirected to.

@ndsvw achieved it by coding his own thing
luong-komorebi/Awesome-Linux-Software#810 (comment)_

I would like to see this ported to lychee.

I don't expect this to be enabled by default but something that could be enabled by a command-line parameter.

@ccoVeille
Copy link
Author

I looked at documentation and found nothing equivalent to this before opening the ticket. If it already exists please let me know, I will happily use it 😅

@mre
Copy link
Member

mre commented Jun 2, 2024

Interesting. Can you be a bit more specific on the details?
Maybe by providing some examples.

From what I can tell, you'd like to fix URLs which get redirected.
So if example.com redirects to foo.example.com then lychee should suggest a replacement?

We have a --suggest parameter, which suggests replacements from archive.org for dead links. Maybe we could add this as another feature of --suggest @thomas-zahner?

@ccoVeille
Copy link
Author

Hi @mre

Thanks for replying me

Here is an example

luong-komorebi/Awesome-Linux-Software#814

The whole PR is how fixing the URLs to their redirection.

@ndsvw managed to do it by using his own homemade tool/script

About the concept, the logic would be around a --update-redirected or something like that

@ccoVeille ccoVeille changed the title Automatic remap via redirection optionally gix document when URL are redirected Jun 2, 2024
@ccoVeille ccoVeille changed the title optionally gix document when URL are redirected optionally fix document when URL are redirected Jun 2, 2024
@mre
Copy link
Member

mre commented Jun 13, 2024

Just to clarify, the feature would replace the links in-line, right? So it would go and fix the links in the documents.
Maybe it could be part of a --fix flag, which would fix this and other problems. Not sure yet.

@ccoVeille
Copy link
Author

ccoVeille commented Jun 13, 2024

Yes, that's the idea.

So if someone mention http://www.google.com it would send to https://www.google.com

http://oldsite.com => https://whatever.io

Of course, it would not only affect domain redirection, but also page redirection.

https://site.com/oldpage/ => https://site.com/section/#whatever

This could help to identify things to fix.
At least it should provide a warning in default mode to follow HTTP Permanent Redirect. I don't think See Other or Temporary Redirect should be reported or fixed.

Then with a flag that could be --fix or anything else to be defined, it would rewrite the links in documents

@ccoVeille
Copy link
Author

I hope it's clearer @mre

@thomas-zahner thomas-zahner added the enhancement New feature or request label Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants