Created
June 11, 2014 08:00
-
-
Save andrewboni/9ec18c2806a87d1a2f9a to your computer and use it in GitHub Desktop.
A Hexo blog plugin for embedding Soundcloud songs.
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
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}&auto_play=false&hide_related=true&show_comments=true&show_user=true&show_reposts=false&#{options}'></iframe>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment