Create your own Shortcodes to Embed Telegram post.

You can extend Hugo’s built-in shortcodes by creating your own using the same templating syntax as that for single and list pages.

Hugo documents

File Location

To create a shortcode, place an HTML template in the layouts/shortcodes directory of your source organization. Consider the file name carefully since the shortcode name will mirror that of the file but without the .html extension.


Create telegramPost.html inside layouts/shortcodes

<div id="tgPost">
<script type="text/javascript"></script>
  async src=""
  data-telegram-post="{{ .Get 0 }}/{{ .Get 1}}"

layouts/shortcodes/telegramPost.html will be called with{{< telegramPost channelName PostId >}}

For instance:

{{< telegramPost programmerjokes 2246 >}}


Create Your Own Shortcodes

A way to mark plain-text and stop hugo from interpreting?