Skip to content

Instantly share code, notes, and snippets.

@kidGodzilla
Created February 11, 2021 06:17
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 kidGodzilla/72b63275dcb809c43b3a743c6ef11acd to your computer and use it in GitHub Desktop.
Save kidGodzilla/72b63275dcb809c43b3a743c6ef11acd to your computer and use it in GitHub Desktop.
Create a custom Indie.am Blog Embed
<!-- I've created an example you can peek at here: -->
<!-- https://jamesfuthey.com/audiolog -->
<script>
// First, set your Log ID (typically indie.am/<log_id>
window.logId = 'james';
// Now, we fetch data, and print our logs on our current page
fetchData(function () {
// This will output a new array of entries at window.sounds
// We can iterate through our entries and display them in our blog template
sounds.forEach((sound, i) => {
// In this example I use jQuery to append each post, but you can do whatever you like with the window.sounds array
$('.blog-simple').append(`
<article class="amplitude-play" data-amplitude-song-index="${ i }" style="cursor:pointer" onclick="$('#docked-player').show()">
<div class="featured-image" style="background-image:url(${ sound.cover_art_url })"></div>
<h2>${ sound.name }</h2>
<time>${ sound.album }</time>
</article>
`);
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment