Hello everyone,
I noticed that my shortcodes don’t behave the same in the deployed site (hosted with GitHub Pages, deployed with GitHub Actions as described in the official documentation) as in a local build (built locally with hugo server
or hugo server -D
, localhost).
Before I come to the point, I also wanted to mention that I noticed that, after running the hugo
command, all the website files get stored in a folder called docs
, not in the public
folder. It didn’t prevent me from deploying my site, since I simply changed the publish_dir
to docs
. I hope that’s not something horribly bad or an unintended behaviour. Just wanted to mention that first. I am using Hugo v.0.83.1.
Now regarding my actual problem. In my locally built site, the shortcode behaves as expected. It’s a simple shortcode formatting the content of it. The only problem is, that even though I actually added a space between the text and the declaration of the shortcode (see example below), it doesn’t add a space in the deployed site on GitHub Pages, whereas it behaves as expected in a locally built site.
Let me show an example.
This is the Markdown content:
Apart from the {{<link `path` `_blank`>}}official API reference{{</link>}}
And this is the shortcode (simplified):
{{ $p0 := .Get 0 }}
{{ $p1 := .Get 1 }}
{{ $inner := .Inner }}
<a href="{{ $p0 }}" target="{{ $p1 }}" class="shortcode-link">{{$inner}}</a>
(I even tried to add a space inside the shortcode, didn’t help either)
This is how it looks like in the locally built site:
This is how it looks like in the deployed site:
That happens with two shortcodes, that are supposed to format inline text inside a block of text and no attempt to fix this worked. Whether it’s adding another space inside the Markdown file or adding a space inside the shortcode. None of these attempts turned out to be helpful.
Thank you already in advance.