Skip to content

Instantly share code, notes, and snippets.

@jxxe
Last active July 22, 2023 07:58
Show Gist options
  • Save jxxe/fb8e52251e67fd269964c20bda846e1d to your computer and use it in GitHub Desktop.
Save jxxe/fb8e52251e67fd269964c20bda846e1d to your computer and use it in GitHub Desktop.
Redirect to latest Laravel documentation
// ==UserScript==
// @name Laravel Documentation Redirect
// @match https://laravel.com/docs/*
// @version 1.0
// @author Jerome Paulos
// @description Automatically redirect to the latest Laravel documentation
// @downloadURL https://gist.github.com/jxxe/fb8e52251e67fd269964c20bda846e1d/raw/laravelDocRedirect.user.js
// ==/UserScript==
(() => {
const latestUrl = document.querySelector('#version-switcher option[value*="/master/"] + option').value;
const latestPath = new URL(latestUrl).pathname;
if(location.pathname !== latestPath) location.href = latestUrl + location.hash;
})();
@jxxe
Copy link
Author

jxxe commented Jul 22, 2023

  1. Install the Violentmonkey extension for Chrome, Firefox, or Edge
  2. Click here to install this script
  3. Visit any out-of-date Laravel documentation URL (example)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment