Dvc.org: broken external links at community tutorials page

Created on 14 Apr 2020  ·  17Comments  ·  Source: iterative/dvc.org

At https://dvc.org/doc/tutorials/community you see all the links are pointing to dvc site and 404 although content/docs/tutorials/community.md is featuring proper external links.

Tried investigating root cause, might be something in redirects-list.json & src/utils/shared/redirects.js

Also, not 100% relevant (and sure :)), but in gatsby-config both external-link-plugin & gatsby-remark-external-links are used which might be doing similar things

bug doc-engine priority-p0 website

All 17 comments

Great find! It applies to the first 3 links and to the last one. Investigating... ⏳

@iAdramelk @pavelgrinchenko this doesn't seem to be a problem with the markdown or with the redirect list. The links in code are correct so the link checker doesn't catch these 404s. Maybe it's a Gatsby problem indeed?

p.s. seems to be replacing host names that have subdomains (e.g. blog.codecentric.de or www.linkedin.com) for the server host name.

p.p.s. it's affecting all external links everywhere in the website e.g. https://dvc.org/doc/understanding-dvc/resources#articles so definitely a docs engine problem.

@jorgeorpinel not sure it's broken the same way in develop & build mode, but

This is happening for
1) external links
2) that end with trailing /
Because of redirect rule being applied and returning only relative part of URL

Details:
<Link> component is calling getRedirect here and
this "^/(.+)/$" pattern is being checked against path part of external URLs omitting the host, returning relative urls that are being rendered instead of original external url.

So as a quickfix, can just remove trailing / from external links to avoid this and might need to modify redirect matching/using results logic

@pavelgrinchenko Can you please check it?

I think @sudodoki is right, we should probably reapply host for the links if it's not equal to the current site or return original link without removing / for such links, but maybe I'm missing some edge case there.

@jorgeorpinel I made PR with fix, could you review it

@pavelgrinchenko thanks! 🙏 Merged.

@sudodoki

external-link-plugin & gatsby-remark-external-links

names are confusing indeed, buy yes, we need both - one to support custom HTML in blog (it is a a custom plugin we wrote), second one - is regular gatsby that deals with ext links.

Good catch, btw. Thanks for the report.

@pavelgrinchenko it looks like it is still broken :(

@shcheklein at which page are you seeing same behavior? https://dvc.org/doc/tutorials/community links from original issue seem fixed.

And the one mentioned in thread https://dvc.org/doc/understanding-dvc/resources#articles as well

@sudodoki links are fixed, but when I click them they still redirect me to dvc.org Not Found. Is it only me? 🤔

@shcheklein I forgot to add domain check to click handler... Here is another fix

@shcheklein Hm, seems this logic outdated there at all as we are already replacing original href with redirected when it's necessary. So I removed it from the click handler

Awesome, great fix. Thanks guys! And thanks again @sudodoki

Oops only the URLs are fixed. It works OK when you Cmd/Ctrl+click but regular click changes the page to dvc.org 404 still... Cc @pavelgrinchenko

p.s. I tried with no browser cache

It works for me now. Not sure what was the issue after the deployment, but it works. @jorgeorpinel could you please confirm and reopen if it is still broken?

It works OK for me now as well.

Was this page helpful?
0 / 5 - 0 ratings