Hugo Shortcode for Deploy to Digital Ocean Buttons #
Allow users to start your Application hosted on GitHub with a click with official Deploy to DigitalOcean buttons.
Do not forget to prepare your repository following the official DigitalOcean guide.
Add your referral code to get some benefits from DigitalOcean, if someone will register by your link.
Minimal example #
This is just an example of a button, my project is not configured to easy deploy yet:
Code:
{{< deploy-to-do owner="isqua" repo="docker-koken" >}}
Full example #
Code:
{{< deploy-to-do
owner="isqua"
repo="docker-koken"
branch="master"
theme="blue-ghost"
alt="Deploy Koken"
refcode="a67fb72fe5ce"
>}}
Parameters #
Parameter | Default | Description |
---|---|---|
owner | — | Username or organization name who owns the repository |
repo | — | The repository name |
branch | "main" | The repository branch to deploy |
theme | "blue" | One of button theme: blue , blue-ghost , white-ghost , or white |
alt | "Deploy to Digital Ocean" | The text alternative to image for screen readers |
refcode | — | The code of Digital Ocean referral program. |
Site Parameters #
You can set defaults in Site Parameters. For config.toml
:
[params.HugoShortcodes.DigitalOcean]
RefCode = 'your_referral_code'
BadgeTheme = 'blue'
[params.HugoShortcodes.Github]
Owner = 'your_github_login_or_org_name'
Repository = 'your_repository_name'
Branch = 'default_branch'
For config.yaml
:
params:
HugoShortcodes:
DigitalOcean:
RefCode: your_referral_code
BadgeTheme: blue
Github:
Owner: your_github_login_or_org_name
Repository: your_repository_name
Branch: default_branch
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.