Skip to content

Instantly share code, notes, and snippets.

@lostfictions
Created July 10, 2026 04:24
Show Gist options
  • Select an option

  • Save lostfictions/ec46034dd08c983942109ac65965705b to your computer and use it in GitHub Desktop.

Select an option

Save lostfictions/ec46034dd08c983942109ac65965705b to your computer and use it in GitHub Desktop.
Remove ref tags from outgoing Ghost blog links
// ==UserScript==
// @name Remove ref tags from outgoing Ghost blog links
// @match https://readonlymemo.com/*
// @match https://aftermath.site/*
// @grant none
// @run-at document-idle
// ==/UserScript==
const matcher = /[?&]ref=[^&#]+/i;
for (const a of document.querySelectorAll('a[href]')) {
const match = a.href?.match(matcher);
if (match) {
a.href = [...a.href].toSpliced(match.index, match[0].length).join('');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment