Skip to content

Instantly share code, notes, and snippets.

@andrewboni
Created June 11, 2014 08:00
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 andrewboni/9ec18c2806a87d1a2f9a to your computer and use it in GitHub Desktop.
Save andrewboni/9ec18c2806a87d1a2f9a to your computer and use it in GitHub Desktop.
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 = "https://w.soundcloud.com/player/?url=#{encodeURIComponent(songUrl)}"
if type is "visual"
options = "visual=true"
else if type is "default"
options = "color=ff5500&show_artwork=true"
else
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