Skip to content

Instantly share code, notes, and snippets.

@encarsia
Last active November 29, 2019 16:24
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 encarsia/da438431ca42781045b4d63ac1b9ea5c to your computer and use it in GitHub Desktop.
Save encarsia/da438431ca42781045b4d63ac1b9ea5c to your computer and use it in GitHub Desktop.
Mastodon shortcode for Nikola (Mako template)
<%doc>
Template engine: Mako
Usage:
{{% mastodon status=https://instance.domain/@user/tootnr %}}
Optional parameters:
width (default: 600)
height (default: 333)
Example: {{% mastodon status=https://instance.domain/@user/tootnr % width=300 height=600}} will show a 300x600 frame instead of the default 600x333
</%doc>
% if width is UNDEFINED:
<% w = 600 %>
% else:
<% w = width %>
% endif
% if height is UNDEFINED:
<% h = 333 %>
% else:
<% h = height %>
% endif
<iframe src="${status}/embed" class="mastodon-embed" style="max-width: 100%; border: 0" width=${w} height=${h}"</iframe>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment