Embed Tweet

I used the tweet shortcode already, however I do not like the style how the tweet is presented. I would prefer the style like it is produced by the Twitter API:

image

Any ideas how to embed a Tweet like this in Hugo?

Snippets like other content may be overridden, may be overridden, though built-ins have graceful degradation and privacy options baked in. Looking here it seems some of the styles may be controlled by data- attributes and those seem a reasonable addition to the internal layout if passed as a custom-defined (and styled) widget.

$widgetId := "235635884"
{{< tweet id=8675309 wid=$widgetId >}}

Though when embedding quotes it’s also often valuable to provide a lang attribute indicating the locale like lang="en_GB" so perhaps a Dict with a whitelist of allowed attributes would better suit common use cases:

$callme := (dict "data-widget-id" "23" "lang" "en_GB")
{{< tweet 8675309 $callme >}}
1 Like