Questions tagged [hugo-shortcode]
78 questions
32
votes
2 answers
Hugo shortcode ignored saying "raw HTML omitted"
I have written a shortcode to create a bootstrap dismissable alert box. Below is my shortcode called as layouts/shortcodes/message.html.
{{.Inner}}
17
votes
4 answers
Use variable inside Hugo content
I'm trying to use a variable within the content of a Hugo statically generated site. For example, the content looks like the following:
Go to your site's url ({{ .Site.BaseURL }})
Enter your credentials
.....(blah blah blah)
When this gets…

jloosli
- 2,461
- 2
- 22
- 34
14
votes
2 answers
Use shortcode within definition of shortcode
How can I reuse a shortcode in Hugo within another shortcode?
I only found a way to nest shortcodes within markdown but what I want to do is to reuse a shortcode within the definition of another shortcode.

user2033412
- 1,950
- 2
- 27
- 47
10
votes
2 answers
Embed a tweet in a blogdown post
I want to embed a tweet with an image. When I embed a tweet on a blogdown post using shortcodes it does not appear in the twitter style
For example using the shortcode:
{{< tweet 989470885475008512 >}}
I get an output (my blogdown uses the…

guyabel
- 8,014
- 6
- 57
- 86
7
votes
1 answer
R Blogdown Hugo academic theme not rendering site
I am trying to create a website using R Blogdown Hugo-Academic theme. Typically, I would create a website by running the following commands:
blogdown::new_site(theme = 'gcushen/hugo-academic')
blogdown::serve_site()
But I am getting an error
failed…

sheth7
- 351
- 2
- 14
7
votes
2 answers
How to insert a linebreak in hugo image tag title element?
I am using blogdown and kakawait/hugo-tranquilpeak-theme to write a plain markdown blog post. When I add images with the shortcode option tag such as
{{< image classes="fancybox right clear" src="image2.png" …

Philipp Gärtner
- 196
- 1
- 8
6
votes
2 answers
Can I create links with 'target="_blank"' in hugo posts content using Markdown?
I use Hugo to deploy static web, using Markdown and the problem I would like to sort out is simple.
I would like to find the simplest and compatible with Markdown language way to make my web links open in different tab.
The method I use now is…

Marcin
- 173
- 12
5
votes
2 answers
Regex Capturing Group in Hugo
Recently I wanted to switch my static site generator from Jekyll to Hugo. I really like Hugo, but unfortunately, the usage of some functions often bothered me.
consider the code below,
{{ $my_var := `id="demo"` }}
{{ $my_slice := (findRE…

Carson
- 6,105
- 2
- 37
- 45
4
votes
2 answers
HUGO + GitHub Pages: How to set up subdomain
I have a github repository that I want to add my hugo site to. From the docs folder in my repository I can run github pages.
Therefore, I have changed my publishDir parameter in the hugo config to docs.
publishDir = "docs"
Now when I build hugo it…

JamesG
- 1,552
- 8
- 39
- 86
3
votes
1 answer
How to embed a YouTube playlist in hugo website
I can make use of the following code, {{< youtube hvWSg6NblSU >}} to embed the YouTube video in hugo website, where hvWSg6NblSU is the value in following url: https://www.youtube.com/watch?v=hvWSg6NblSU
Instead of embedding a single video, I want to…

Naresh Chaurasia
- 419
- 5
- 21
3
votes
3 answers
How to give a Hugo / markdown table a class, when the table contains shortcodes?
In hugo (version v0.77.0) I'm trying to render a table with some specific styling. I'm using the
I'm trying to use zwbetz's {{ bootstrap-table "classname" }} shortcode. It's defined in /layouts/shortcodes/bootstrap-table.html like this:
{{…

O. Jones
- 103,626
- 17
- 118
- 172
3
votes
1 answer
Hugo data files from dynamic parameter
I'm developing a big hugo template. I try to simplfy the problem, so I have two datafile:
PROMO_00_1.yaml
PROMO_00_2.yaml
that are phisically stored in this directory:
themes/data/hp/
So, in the site config the user will decide which of this data…

pinguinone
- 433
- 1
- 6
- 14
3
votes
1 answer
How to strip exif from image original
I like to follow the shortcode conventions like described here: https://laurakalbag.com/processing-responsive-images-with-hugo/
and setting exif parameters in config.toml like so
[imaging.exif]
# Regexp matching the fields you want to Exclude from…

Klapaucius Klapaucius
- 619
- 3
- 13
3
votes
2 answers
How can you get the full path of a page resource in Hugo?
I have some posts in Hugo with page resources that are SVG files that I want to include inline in the resulting HTML. For example, here's a typical folder structure:
content
+-- posts
+-- somepost
+-- index.md
+-- diagram.svg
In…

Bruno Girin
- 175
- 2
- 10
3
votes
0 answers
Blogdown::Shortcode doesn't work after using emo package in R
I am using Blogdown and want to use a shortcode in an Rmd file. I am using shortcodes in a chunk, not in an inline code.
I saw this question Cannot use Markdown shortcodes in Blogdown's Rmd files and the solution…

denizCvrl
- 31
- 1