Skip to content

Commit

Permalink
chore(fundamental-redirects): add more /docs/ prefix redirects (#11223)
Browse files Browse the repository at this point in the history
We see a couple of page URLs without /docs/ in our top HTTP 404s list:
- /en-US/Media_formats_supported_by_the_audio_and_video_elements
- /en-US/JavaScript_typed_arrays/ArrayBuffer
- /en-US/JavaScript_typed_arrays/Uint8Array
- /en-US/ECMAScript_DontEnum_attribute
- /en-US/Using_audio_and_video_in_Firefox
  • Loading branch information
caugner authored May 31, 2024
1 parent 47a02e6 commit 537bbf7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libs/fundamental-redirects/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ const MISC_REDIRECT_PATTERNS = [
// redirects often take over from there, so let's only insert "/docs/"
// and let any other redirect rules work from that point onwards.
localeRedirect(
/^(?<prefix>AJAX|CSS|DOM|DragDrop|HTML|JavaScript|SVG|Tools|Using_files_from_web_applications|Web|XMLHttpRequest|Security)(?<subPath>\/.+?)?\/?$/i,
/^(?<prefix>AJAX|CSS|DOM|DragDrop|ECMAScript_DontEnum_attribute|HTML|JavaScript|JavaScript_typed_arrays|Media_formats_supported_by_the_audio_and_video_elements|SVG|Tools|Using_audio_and_video_in_Firefox|Using_files_from_web_applications|Web|XMLHttpRequest|Security)(?<subPath>\/.+?)?\/?$/i,
({ prefix, subPath = "" }) => `/docs/${prefix}${subPath}`,
{ permanent: true }
),
Expand Down
16 changes: 16 additions & 0 deletions testing/tests/redirects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1222,15 +1222,27 @@ const MISC_REDIRECT_URLS = [].concat(
"/en-US/DragDrop/Drag_and_Drop/",
"/en-US/docs/DragDrop/Drag_and_Drop"
),
url_test(
"/en-US/ECMAScript_DontEnum_attribute",
"/en-US/docs/ECMAScript_DontEnum_attribute"
),
url_test("/en-US/HTML", "/en-US/docs/HTML"),
url_test("/en-US/HTML/", "/en-US/docs/HTML"),
url_test("/en-US/HTML/Canvas/", "/en-US/docs/HTML/Canvas"),
url_test("/en-US/JavaScript", "/en-US/docs/JavaScript"),
url_test("/en-US/JavaScript/", "/en-US/docs/JavaScript"),
url_test(
"/en-US/JavaScript_typed_arrays/ArrayBuffer",
"/en-US/docs/JavaScript_typed_arrays/ArrayBuffer"
),
url_test(
"/en-US/JavaScript/Reference/About/",
"/en-US/docs/JavaScript/Reference/About"
),
url_test(
"/en-US/Media_formats_supported_by_the_audio_and_video_elements",
"/en-US/docs/Media_formats_supported_by_the_audio_and_video_elements"
),
url_test("/en-US/SVG", "/en-US/docs/SVG"),
url_test("/en-US/SVG/", "/en-US/docs/SVG"),
url_test("/en-US/SVG/Element/font/", "/en-US/docs/SVG/Element/font"),
Expand All @@ -1240,6 +1252,10 @@ const MISC_REDIRECT_URLS = [].concat(
"/en-US/Tools/Memory/Treemap_view/",
"/en-US/docs/Tools/Memory/Treemap_view"
),
url_test(
"/en-US/Using_audio_and_video_in_Firefox",
"/en-US/docs/Using_audio_and_video_in_Firefox"
),
url_test(
"/en-US/Using_files_from_web_applications",
"/en-US/docs/Using_files_from_web_applications"
Expand Down

0 comments on commit 537bbf7

Please sign in to comment.