Another Simple PR

This was another simple issue that I created a pull request for. It was just to add a code of conduct file to the repository, and link to it from the CONTRIBUTING.md file. In looking into doing this pull request, I had noticed that the link from the README.md file to CONTRIBUTING.md was broken (mentioned in an earlier blog post). So after fixing this, I pulled the code of conduct file into the repo, and gave a relative link to it from the CONTRIBUTING.md file.

It was only later that I realized I had given this relative link by habit. All of the other links to markdown files in the repo were absolute. The thing with using absolute links is that if you fork a repository, or are in another branch of the main repository, and then click on an absolute link, it will take you from the current repository/branch to the branch on the repository that the absolute link points to. With a relative link, you link to a file in the same directory, on the same branch of your repository.

Both of these approaches to providing link paths have their own advantages: using absolute links means you can force users to always be redirected to a specific version of a file that is on a specific branch, and using a relative link ensures that users always see the file that is local to the repository and branch they are working in. If you wanted users to always see the most current version of your Contributing.md or code of conduct, or README, it may make sense to use absolute links. However, things like instructions for build processes in CONTRIBUTING.md, have information that changes with, and is relevant to a specific commit on a specific branch. Redirecting users away from the files that are relevant to that snapshot in time of the repository might lead to confusion. For this reason, I think it is generally best to prefer relative links.

Comments

Popular posts from this blog

Tinkering with Chrome Headless to Handle Mic Input

Using Arrow keys to cycle through Mozilla Screenshots

A look back at Hacktoberfest