Skip to content

santosh/hugo-shortcodes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hugo-shortcodes

GitHub repo size GitHub contributors GitHub stars GitHub forks GitHub followers

While writing posts in markdown, writing HTML embed codes directly don't work. And shortcodes were created to fill this gap only. Shortcodes also DRY up things. You can find more information about shortcodes at Hugo Docs.

hugo-shortcodes theme components contains a list of unofficial Hugo shortcodes. If you are using a shortcode your blog, that you think belongs here, please make a PR.

Getting Started

hugo-shortcodes comes as a theme component which makes it modular and easy to integrate in your existing site.

Install

  • cd to your Hugo powered site.
cd ~/repos/yoursite.dev
  • Add this repo as a theme i.e. inside theme directory of your site.
git submodule add https://github.com/santosh/hugo-shortcodes.git themes/hugo-shortcodes
  • Modify config.toml to list hugo-shortcodes as theme.
theme = ["hermit", "hugo-shortcodes"]

Note: In theme declaration in the config file. Componenets listed to the right will override components listed to the left of it. This means if two themes components defined same things, the later will be in effect. Check out theme component docs.

Update

The easiest way to update hugo-shortcodes to latest is to issue following command from your main repo:

git submodule update --remote --merge themes/hugo-shortcodes

This will pull the latest updates from this repo and you will left to git add from your main repo.

Usage

Below are possible directions to use available codes.

Giphy

  • Visit https://giphy.com/
  • Search for your term, and open gif page.
  • Copy the gif ID and pass if to giphy. Like below:
{{< giphy 12UlfHpF05ielO >}}

You get a responsive version of gif embedded to the post.

Blockquote

Blockquote takes:

  • a source as first argument
  • a body enclosed between {{< blockquote >}} tags, Like so:
{{< blockquote "webassembly.org" >}}
WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable target for compilation of high-level languages like C/C++/Rust, enabling deployment on the web for client and server applications.
{{</ blockquote >}}

Contributing

Do you have an idea for a shortcode? Can you enhance an exiting shortcode? Or do you already use a certain shortcode that you want to be listed here? Great! Head over to contribution guidelines to get started.

Contributors

Thanks to the following people who have contributed to this project:

License

This project uses Apache 2.0. Same as Hugo.

About

An unofficial list of commonly used shortcodes.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages