Hugo shortcode for https://buttons.github.io/
Add this shortcode to a hugo theme or project. Add the shortcode to a hugo page markdown to display a GitHub button on the page.
Read about how this shortcode was created at Statropy Software
{{< github_button button="<button_type>" user="<user_name>" >}}
- Type:
string
- Usage:
required
This selects the type of button to display.
follow
sponsor
watch
star
fork
template
issue
download
view
- Type:
string
- Usage:
required
The GitHub username for the button link.
- Type:
string
- Usage:
required
forwatch
,star
,fork
,template
,issue
,download
The GitHub repo for the button link.
- Type:
string
,true
to enable - Usage:
optional
forfollow
,watch
,star
,fork
,issue
- Default:
false
Attach the applicable number to the button for the specified type.
- Type:
string
,true
to enable - Usage:
optional
- Default:
false
Use the dark button theme if enabled, otherwise light theme.
- Type:
string
,true
to enable - Usage:
optional
- Default:
false
Use a larger button if enabled.
- Type:
string
- Usage:
optional
fordownload
- Default:
master
Specify a branch other than master for the download.
- Type:
string
- Usage:
optional
Override the default icon for a button type. Valid icons are
mark-github
heart
eye
star
repo-forked
repo-template
issue-opened
download
- Type:
string
- Usage:
optional
Override the default button text for a button type.
- Type:
string
- Usage:
optional
Override the default aria-label for a button type.
button | icon | text | path https://github.com | aria-label |
---|---|---|---|---|
follow | mark-github | Follow @user |
/user |
Follow @user on GitHub |
sponsor | heart | Sponsor | /sponsors/user |
Sponsor @user on GitHub |
watch | eye | Watch | /user /repo /subscription |
Watch user /repo on GitHub |
star | star | Star | /user /repo |
Star user /repo on GitHub |
fork | repo-forked | Fork | /user /repo /fork |
Fork user /repo on GitHub |
template | repo-template | Use this template | /user /repo /generate |
Use this template user /repo on GitHub |
issue | issue-opened | Issue | /user /repo /issues |
Issue user /repo on GitHub |
download | download | Download | /user /repo /archive/branch .zip |
Download user /repo on GitHub |
view | mark-github | repo |
/user /repo |
View user /repo on GitHub |
Follow button and Follow button with followers count:
{{< github_button button="follow" user="statropy" >}}
{{< github_button button="follow" user="statropy" count="true" >}}
A large Star button with stargazers count in dark theme:
{{< github_button button="follow" user="statropy" repo="github-button-hugo-shortcode" count="true" large="true" dark="true" >}}
Download button for a branch named bugfix:
{{< github_button button="download" user="statropy" repo="github-button-hugo-shortcode" branch="bugfix" >}}
All buttons:
{{< github_button button="follow" user="statropy" >}}
{{< github_button button="sponsor" user="statropy" >}}
{{< github_button button="watch" user="statropy" repo="github-button-hugo-shortcode" count="true" >}}
{{< github_button button="star" user="statropy" repo="github-button-hugo-shortcode" count="true" >}}
{{< github_button button="fork" user="statropy" repo="github-button-hugo-shortcode" count="true" >}}
{{< github_button button="template" user="statropy" repo="github-button-hugo-shortcode" >}}
{{< github_button button="issue" user="statropy" repo="github-button-hugo-shortcode" count="true" >}}
{{< github_button button="download" user="statropy" repo="github-button-hugo-shortcode" >}}
{{< github_button button="view" user="statropy" repo="github-button-hugo-shortcode" >}}
Add the snippet from layouts/partials/head.html
to the head.html in the project or theme. This loads the button script on each page that includes a button.
Add layouts/shortcodes/github_button.html
to the layouts/shortcodes
folder of the project or theme.
Add the shortcode to a page
{{< github_button button="follow" user="statropy" >}}