UMCarpentries / intro-curriculum-r

Custom curriculum for teaching R, the Unix Shell, & Git with an integrated workflow and reproducible research practices.
https://umcarpentries.org/intro-curriculum-r/
Other
9 stars 12 forks source link

Better broken link detection #166

Closed MrFlick closed 2 years ago

MrFlick commented 2 years ago

Issues

There were a few false positives in the broken link detection. The main issue was that some links had a trailing slash and some did not:
https://umcarpentries.org/intro-curriculum-r/05-r-markdown/ vs
https://umcarpentries.org/intro-curriculum-r/05-r-markdown

In that case, it's hard to know whether 05-r-markdown is a page or a folder. I changed the code to request the page and then check if the server issued a redirect. So if you request the page without the slash, you are redirected to the version with the slash (the canonical name for the resource). This means we a better able to check relative links in that case.

It's still not possible for the client to know for sure that https://umcarpentries.org/intro-curriculum-r/05-r-markdown/ and https://umcarpentries.org/intro-curriculum-r/05-r-markdown/index.html are the same resources. It would be nice to standardize all URLs either to use the "index.html" file or to leave it off and end the path with a slash. But this just means that values are repeated for the identical pages with different URLs.

I also cleaned up some existing broken links. I noticed that many of the existing links in the Rmd files were already fixed by @kelly-sovacool but it seems that the Rmd files were not rendered into HTML files for the website. I am unable to run the build steps on my own machine to render the site.

The last issue is that all-in-one page (aio) has several duplicate IDs. Sections like "#bonus" are repeated in multiple lessons. So when everything is combined on the same page, those IDs are no longer unique. This means that if you click a later "bonus" link, you are sent to the first bonus section, for example. I'm not sure how important that is but we could make the section names unique across all lessons.

Checklist

kelly-sovacool commented 2 years ago

Thanks @MrFlick! I ran make site and pushed it to your branch. For some reason the GitHub Actions workflow isn't pushing commits correctly...