Migrate built-in Hugo shortcodes as URLs
Closed this issue · 2 comments
Hugo provides built-in shortcodes that "represent very common usage" for convenience. The intention is to keep Markdown clean, but because they are proprietary to Hugo, they don't migrate nicely, so a Tweet shortcode ends up looking like:
{{< tweet 877500564405444608 >}}
Where possible, these would make more sense as plain URLs:
https://twitter.com/twitter/status/877500564405444608
For a subset (e.g. gist
, tweet
, and youtube
), converting shortcodes to URLs allows Pro users to get proper embeds via embed.as; in all cases, special care must be taken to craft a valid URL from the shortcode, so we'll limit ourselves to the following shortcodes:
Media | Hugo Shortcode | URL | Embed.as? |
---|---|---|---|
GitHub Gist | {{< gist username gistID >}} |
https://gist.github.com/username/gistID |
✅ |
{{< instagram photoID >}} |
https://www.instagram.com/p/photoID/ |
⛔️ | |
{{< tweet tweetID >}} |
https://twitter.com/twitter/status/tweetID |
✅ | |
Vimeo | {{< vimeo videoID >}} |
https://player.vimeo.com/video/videoID |
⛔️ |
YouTube | {{< youtube videoID >}} |
https://www.youtube.com/watch?v=videoID |
✅ |
This doesn't cover all built-in shortcodes, nor does it cover all options for the shortcodes listed above, but I believe it's a pretty solid set of shortcodes to cover for launch. We can include a note in the README about this limitation, and extend it if the demand exists.
Looks good! I'll take a look at adding Vimeo support in the go-embed library, too.
Closed by #11.