Skip to content

Instantly share code, notes, and snippets.

@MartinMuzatko
Last active July 3, 2017 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MartinMuzatko/cdf7c33fc348340d6f9bfbc4e4793a8e to your computer and use it in GitHub Desktop.
Save MartinMuzatko/cdf7c33fc348340d6f9bfbc4e4793a8e to your computer and use it in GitHub Desktop.
Relink unresolved versioned page
## place somewhere at the bottom before </body> - doesn't matter
<script>
window.spaceKey = '$repository.key'
</script>
// This only works if:
// space key equals viewport URL prefix (.com/is511z/...)
// the user knows a space to link to which potentially got all pages (otherwise - he will get a 404)
// within a document ready function
// $(document).ready(function() {
$('.unresolved').each(function(){
var replaceVersion = 'latest' // put SPACE KEY
$(this).attr('href', $(this).attr('href').replace(spaceKey.toLowerCase(), replaceVersion) )
})
// })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment