Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A Hexo blog plugin for embedding Soundcloud songs.
hexo.extend.tag.register "soundcloud", (args) ->
songUrl = args[0] # Required
type = args[1] or "default" # Optional
soundcloudUrl = "{encodeURIComponent(songUrl)}"
if type is "visual"
options = "visual=true"
else if type is "default"
options = "color=ff5500&show_artwork=true"
return "Error: Soundcloud player type option needs to be either <b>visual</b> or <b>default</b>."
"<iframe width='100%' height='160' scrolling='no' frameborder='no' src='#{soundcloudUrl}&amp;auto_play=false&amp;hide_related=true&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false&amp;#{options}'></iframe>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.