Looking to build and publish a Wowchemy shortcode that doesnβt exist yet?
Unsure if there's already a relevant shortcode? Explore the existing shortcodes.
Wowchemy makes it easy to create a beautiful website for free. Edit your site in Markdown, Jupyter, or RStudio, generate it with Hugo, and deploy with GitHub or Netlify. Customize anything on your site with widgets, themes, and language packs.
- Each Wowchemy shortcode consists of an HTML file
- You may use Go Templating, shortcode parameters, and Bootstrap layouts to design the shortcode
- Click the Use This Template button on GitHub
- Name your repository
wowchemy-shortcode-<SHORTCODE-NAME>
where<SHORTCODE-NAME>
is an appropriate name for your shortcode
- Name your repository
- Browse your new GitHub project, click the
go.mod
file, and then the βοΈ pencil button to edit it- Replace the placeholder URL in
go.mod
with your new GitHub URL in the formmodule github.com/<USERNAME>/wowchemy-shortcode-<SHORTCODE-NAME>
where<USERNAME>
is your GitHub username and<SHORTCODE-NAME>
is the name of the shortcode - Scroll to the bottom and click Commit Changes to save
- Replace the placeholder URL in
- Browse to the
layouts/shortcodes/
folder, clickmy-shortcode.html
, and click the βοΈ pencil button to edit it- Rename
my-shortcode.html
in the text box to a unique ID in the formgithub_<USERNAME>_<SHORTCODE-NAME>.html
, again replacing<USERNAME>
with your GitHub username and<SHORTCODE-NAME>
with your shortcode name - Scroll to the bottom and click Commit Changes to save
- Rename
- Edit the HTML for your new shortcode
- You may use Go Templating and Bootstrap layouts
- View the Hugo docs on Shortcodes
- You can access the shortcode content using
{{.Inner}}
- Check out the built-in shortcodes for inspiration
Say your GitHub username is pikachu
and you wish to create a shortcode named pokemon
:
- We click Use This Template and enter
wowchemy-shortcode-pokemon
as the project name - We replace the first line of
go.mod
withmodule github.com/pikachu/wowchemy-shortcode-pokemon
- We browse to the
layouts/shortcodes/
folder, and renamemy-shortcode.html
togithub_pikachu_pokemon.html
- We customize the HTML in
github_pikachu_pokemon.html
- We add the shortcode to our site and share the shortcode with the community following the guide below
- Install your shortcode in your site by referencing it at the bottom of your
config/_defaults/config.toml
:# At the bottom of your `config.toml` is a Module section: [module] # Your existing modules will appear here. # Add your shortcode's GitHub URL below. # Replace <USERNAME> and <SHORTCODE-NAME> with your GitHub username and shortcode name, respectively. [[module.imports]] path = "github.com/<USERNAME>/wowchemy-shortcode-<SHORTCODE-NAME>"
- Use your shortcode in page content. For example let's create
content/post/test-my-shortcode.md
:--- title: My shortcode date: '2020-11-27' --- Check out my shortcode: {{% github_pikachu_pokemon %}}Content to *process*.{{% /github_pikachu_pokemon %}}
Share your shortcode with the community on Discord and Twitter.