Many of the links to other pages in the Design System omit the trailing slash.
When you omit the trailing slash from a URL in the Design System, the web server will redirect you to the version with the trailing slash – for example if you try to go to design-system.service.gov.uk/components you'll be redirected to design-system.service.gov.uk/components/.
This adds an extra round trip to the server which could otherwise be avoided if we ensure that all links include the trailing slash.
The broken link checker is currently configured to explicitly allow these redirects:
Disabling this would cause the link checker to flag links that redirect, causing builds to fail.
This would potentially mean more failing builds (and thus more back and forth before merging) whilst team members get in the habit of including the trailing slash, so we need to decide if that overhead is worth it for the performance gains.
Why
Avoiding the unnecessary redirect will improve performance, especially for users on slower connections.
For example, on a simulated slow 3G connection, the extra round trip for the 301 redirect takes approx 2 seconds, out of a total 5.77s (till DOMContentLoaded).
The performance impact is still relatively worthwhile but is objectively less noticeable for users on a fast connection – on a 120mb fibre connection the request takes 60ms out of a total 300ms (till DOMContentLoaded).
Who needs to know about this
Developers, anyone that regularly edits the content on the Design System
Done when
[ ] Decide if the overhead of needing to ensure all links include the trailing slash is worth the mild performance gain (for most users)
[ ] Redirects are disabled for the broken link checker
[ ] Redirects fixed throughout the site (by adding the trailing slashes) so the build passes
Given I (thought I…) had done most of the work, I've finished up the changes to get the tests passing and opened a PR… now we just have to decide if we actually want to do this or not!
What
Many of the links to other pages in the Design System omit the trailing slash.
When you omit the trailing slash from a URL in the Design System, the web server will redirect you to the version with the trailing slash – for example if you try to go to
design-system.service.gov.uk/components
you'll be redirected todesign-system.service.gov.uk/components/
.This adds an extra round trip to the server which could otherwise be avoided if we ensure that all links include the trailing slash.
The broken link checker is currently configured to explicitly allow these redirects:
https://github.com/alphagov/govuk-design-system/blob/67ba57d6ae3816bdf57bcf273ad51ad2c6db57f8/lib/metalsmith.js#L287-L290
Disabling this would cause the link checker to flag links that redirect, causing builds to fail.
This would potentially mean more failing builds (and thus more back and forth before merging) whilst team members get in the habit of including the trailing slash, so we need to decide if that overhead is worth it for the performance gains.
Why
Avoiding the unnecessary redirect will improve performance, especially for users on slower connections.
For example, on a simulated slow 3G connection, the extra round trip for the 301 redirect takes approx 2 seconds, out of a total 5.77s (till DOMContentLoaded).
The performance impact is still relatively worthwhile but is objectively less noticeable for users on a fast connection – on a 120mb fibre connection the request takes 60ms out of a total 300ms (till DOMContentLoaded).
Who needs to know about this
Developers, anyone that regularly edits the content on the Design System
Done when