Hugo Pros and Cons shortcode
Shortcode to easily include pro’s and con’s list in Hugo with markdown. This shortcode is derived from the column shortcode.
This article was written for Hugo 0.79
.
Usage
There are no options, content can be added to the pros and cons column in markdown, separated by <-cons->
. The content can be anything (footnotes and formatting is supported as well). Primary intend is to add lists. Note, this shortcode requires to use the %
-syntax (see
this post for more info).
Example
{{% procon %}}
* The fist pro
* The **second** pro
<-cons->
* Not so great feature
* Not ideal either[^why]
* Really bad
{{% /procon %}}
- The fist pro
- The second pro
- Not so great feature
- Not ideal either1
- Really bad
Code
The shortcode which is very straight forward, the content is split by <-cons->
and put in the pros and cons column respectively. Analog as how the
column shortcode works. For more info why print
is required see
this post.
While the Pros
and Cons
text is currently hard-coded in the shortcode it can be easily translated by using Hugo’s built-in
i8n support.
|
|
The accompanying SCSS
|
|
because reasons ↩︎
- Permalink: //oostens.me/posts/hugo-pros-and-cons-shortcode/
- License: The text and content is licensed under CC BY-NC-SA 4.0. All source code I wrote on this page is licensed under The Unlicense; do as you please, I'm not liable nor provide warranty.