Created
February 11, 2021 06:17
-
-
Save kidGodzilla/72b63275dcb809c43b3a743c6ef11acd to your computer and use it in GitHub Desktop.
Create a custom Indie.am Blog Embed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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