Skip to content

Instantly share code, notes, and snippets.

@aormsby
Last active December 22, 2021 03:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aormsby/4a416da862e61893cf262be759fe2701 to your computer and use it in GitHub Desktop.
Save aormsby/4a416da862e61893cf262be759fe2701 to your computer and use it in GitHub Desktop.
Sample shortcode for using mailgo.js in a Hugo site - automatically includes mailgo script in the page body when shortcode is used.
<!-- layouts/shortcodes/mailgo.html -->
{{ if .Get 1 }}
<span class="icon-link">
<a href="#mailgo" data-address="{{ .Get 0 }}" data-domain="{{ .Get 1 }}" >
<img src="/icon/mailgo.png" alt="mailgo" {{ with .Get 2 }} height="{{ . }}" {{ end }} />
</a>
<script src="https://cdn.jsdelivr.net/npm/mailgo@[VERSION]/dist/mailgo.min.js"></script>
</span>
{{ else }}
{{ errorf "missing email params" }}
{{ end }}
<!-- content/posts/mypost.md -->
<!-- using mailgo shortcode..
arg 0 - data-address
arg 1 - data-domain
arg 2 (optional) - icon height
-->
{{< mailgo ormsbyadam gmail.com 100 >}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment