Skip to content

Instantly share code, notes, and snippets.

@jpluimers
Created July 16, 2024 17:07
Show Gist options
  • Save jpluimers/437bac41e32ed3ef43d6fc8587296875 to your computer and use it in GitHub Desktop.
Save jpluimers/437bac41e32ed3ef43d6fc8587296875 to your computer and use it in GitHub Desktop.
Prompt current blog post canonical URL
javascript:(function(){ var postID = document.getElementsByName("comment_post_ID")[0]?.value; var a = document.createElement("a"); if ((typeof HighlanderComments === 'undefined') || (HighlanderComments == null)) { a.href = document.querySelector('link[rel="EditURI"]').href; var searchParams = new URLSearchParams(window.location.search); } else { a.href=HighlanderComments.connectURL; }; a.pathname=''; a.search=`?p=${postID}`; a.hash=''; a.target="blank"; a.rel="noopener"; a.text=document.querySelector('meta[property="og:title"]')?.content; prompt("Anchor", a.outerHTML); } )();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment