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 urls where possible and fix broken and outdated links #887

Merged
merged 8 commits into from
Apr 24, 2024

Conversation

36degrees
Copy link
Contributor

Help me, I've fallen down a link-fixing rabbit hole 🐰 🕳️

This PR:

  • switches to use relative URLs where possible, so that we don't push anyone running the site locally on a preview branch to the live site without them realising (and it makes it easier to maintain)
  • tries to appease the link checker (which is currently not running on CI) by using https wherever possible (looking at you, yum 👀 ) and fixing a few broken links
  • removes other outdated references to cloudapps.digital (including updating links to the AWS request an account tool)

lfdebrux
lfdebrux previously approved these changes Apr 23, 2024
Copy link
Member

@lfdebrux lfdebrux left a comment

Choose a reason for hiding this comment

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

This is really really awesome, thank you for doing this!

@@ -7,7 +7,7 @@ hide_in_navigation: true

# Accessibility

This accessibility statement applies to the GDS Way at [https://gds-way.digital.cabinet-office.gov.uk/](https://gds-way.digital.cabinet-office.gov.uk/).
This accessibility statement applies to the GDS Way at <https://gds-way.digital.cabinet-office.gov.uk/>.
Copy link
Member

Choose a reason for hiding this comment

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

Ooh, nice, I didn't know this was a thing!

Copy link
Member

Choose a reason for hiding this comment

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

Huh, TIL (example from markdown guide), cool

@lfdebrux
Copy link
Member

lfdebrux commented Apr 23, 2024

Outside of the manual sources there's a few more instances of HTTPS urls that could be fixed; I tried to push a commit myself but I don't have permissions, but here's a patch (feel free to squash it or drop it as you wish):

From 3d0fbaf079ed94e2a5eddac5a6b68253db38cace Mon Sep 17 00:00:00 2001
From: Laurence de Bruxelles
 <[email protected]>
Date: Tue, 23 Apr 2024 09:50:57 +0300
Subject: [PATCH] Use https for URLs where possible

---
 README.md                                         | 6 +++---
 script/deploy                                     | 2 +-
 source/manuals/programming-languages/editorconfig | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index fdffba5..a4a4c75 100644
--- a/README.md
+++ b/README.md
@@ -161,7 +161,7 @@ The documentation is [© Crown copyright][copyright] and available under the ter
 of the [Open Government 3.0][ogl] licence.
 
 [rvm]: https://www.ruby-lang.org/en/documentation/installation/#managers
-[bundler]: http://bundler.io/
+[bundler]: https://bundler.io/
 [mit]: LICENCE
-[copyright]: http://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/
-[ogl]: http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/
+[copyright]: https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/
+[ogl]: https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/
diff --git a/script/deploy b/script/deploy
index 758857c..8733bfb 100644
--- a/script/deploy
+++ b/script/deploy
@@ -13,7 +13,7 @@ if [[ ! -f Staticfile.auth ]]; then
   error "Please add a Staticfile.auth file to this directory and try again."
   error
   error "For information on generating a Staticfile.auth, see"
-  error "http://docs.cloudfoundry.org/buildpacks/staticfile/index.html#basic-auth"
+  error "https://docs.cloudfoundry.org/buildpacks/staticfile/index.html#basic-auth"
   exit 1
 fi
 echo "OK!"
diff --git a/source/manuals/programming-languages/editorconfig b/source/manuals/programming-languages/editorconfig
index 320f5bf..5e9c59b 100644
--- a/source/manuals/programming-languages/editorconfig
+++ b/source/manuals/programming-languages/editorconfig
@@ -1,4 +1,4 @@
-# http://EditorConfig.org
+# https://EditorConfig.org
 # https://gds-way.digital.cabinet-office.gov.uk/manuals/programming-languages/editorconfig
 # Copy into project root and rename to .editorconfig
 
-- 
2.44.0

36degrees and others added 8 commits April 23, 2024 14:24
As well as being easier to maintain, this makes it less likely that a user will be confused if they are running the site locally or checking a PR preview and end up on the live site (without realising).
Despite the space between the link text and the `(ACL)` in brackets this is being interpreted as a markdown link with ‘ACL` as a destination, which does not exist. Rewording the link text to include the acronym and changing the name of the reference link fix this.

Also make it a relative URL, rather than including an outdated domain, and match the case of the target URL to avoid a redirect.
Now that we’re using relative URLs wherever possible, it doesn’t make sense to ignore links using the full path.
I have no idea why the markdown on this page is such a mess with so much duplication – I decided unpicking this mess is a job for another day.

I did however remove the link a non existent page on `gds-way-aws-preview.cloudapps.digital` (!?) because it wasn’t referenced anywhere and so wasn’t doing anything.
@@ -8,7 +8,6 @@
.split("\0")
.filter { |path| path.start_with? "source/" }
.map { |path| path.delete_prefix("source/").delete_suffix(".erb").delete_suffix(".md") }
.map { |path| "https://gds-way.cloudapps.digital/#{path}" }

proofer = HTMLProofer.check_directory(
Copy link
Member

Choose a reason for hiding this comment

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

Great catch, was wondering why the previous changes hadn't been picked up

@36degrees 36degrees merged commit 5db216f into main Apr 24, 2024
1 check passed
@36degrees 36degrees deleted the relative-urls branch April 24, 2024 08:53
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.

3 participants