Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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