Skip to content

Instantly share code, notes, and snippets.

@mebinum
Last active July 5, 2022 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mebinum/a336167b97d410ea6df25146fa501658 to your computer and use it in GitHub Desktop.
Save mebinum/a336167b97d410ea6df25146fa501658 to your computer and use it in GitHub Desktop.
Code to show to to embed a gist url into Webflow
<script>
// define the load gist function
var loadGist = function(elem) {
var gistUrl = $(elem).text().match(/\bhttps?:\/\/\S+(.js)/gi);
if (typeof gistUrl === 'undefined' || gistUrl === null || gistUrl.length == 0)
return;
//load gist
$(elem).show();
$(elem).empty();
postscribe(elem, '<script src=' + gistUrl+ '><\/script>');
};
if (postscribe) {
var gists = $('p:contains("CODE:")');
gists.hide();
gists.toArray().forEach(loadGist);
} else {
console.log("you need to include postscribe in your site for this to work")
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment