Hugo Shortcode for Gumroad #
Sell your products with Gumroad buttons and overlays. Read more in Gumroad Help.
Minimal example #
Here is a simple embedded button for Gumroad good:
Get onCode:
{{< gumroad-button id="demo" >}}Get on{{</ gumroad-button >}}
Full example #
Get with 10% discount onCode:
{{< gumroad-button id="demo" affiliate="12345678" >}}Get with 10% discount on{{</ gumroad-button >}}
Parameters #
Parameter | Default | Description |
---|---|---|
id | — | ID of your good. You can get it from the URL of the good on Gumroad |
affiliate | — | Code of your affiliate Program |
inner text | — | The text to show on the button |
Site Parameters #
You can set defaults and custom domain in Site Parameters. For config.toml
:
[params.HugoShortcodes.Gumroad]
Host = 'https://your_domain.com'
Affiliate = '123456789'
For config.yaml
:
params:
HugoShortcodes:
Gumroad:
Host: "https://your_domain.com"
Affiliate: "123456789"
Installation #
Don’t forget to install shortcode before usage.
Install all shortcodes at once
If you need dozens of them, it’s better to attach this repository as a theme to your website.
First, add the theme as a git submodule:
git submodule add -b theme https://github.com/isqua/hugo-shortcodes.git themes/hugo-shortcodes
Then add the theme to your config.toml
. Most likely you have the following line in your config:
theme = 'ananke'
There may be another theme in place of “ananke”.
Then surround the theme with square brackets, and appends 'hugo-shortcodes'
with a comma at the end:
theme = [ 'ananke', 'hugo-shortcodes' ]
That’s it! If your hugo server is running, it is better to restart it to avoid unexpected behavior.
Now you can use all the shortcodes on any content page of your site.
Install only current shortcode
If you need only one shortcode or installing a theme is too complicated, you may get it easier.
- First, download shortcode file.
- Put the file into your
layouts/shortcodes
folder.
That’s it! If your hugo server is running, it is better to restart it to avoid unexpected behavior.
Now you can use the shortcode on any content page of your site.