[SOLVED] How to add relURL to: {{< figure src=


I have an issue with the built in figure shortcode.

baseurl = "http://example.com"

└── img
    ├── gohugo.io
    │   └── hugo.ipsum.png

{{< figure src="/img/gohugo.io/hugo.ipsum.png" >}}

All fine. But with
baseurl = "http://example.com/foo"

I still get:
img src="/img/gohugo.io/hugo.ipsum.png"

missing the foo part.

How do I use relURL with the figure shortcode?
Or is there any other solution (without recreating the built in shortcode)?

(Hugo Static Site Generator **v0.32.3** linux/amd64 BuildDate: 2018-01-09T15:21:59+01:00)

Testing site is here:


Seems code is here:

<img src="{{ .Get "src" }}"

Doc is here:

{{< figure src="/media/spf13.jpg"

If baseurl is someting like “http://example.com/foo” - I think this will fail.

I’ve taken into advice:

If you’re creating a theme with plans to share it with the community,
use relative URLs since users of your theme may not publish from the root of their website

Does this apply to internal shortcodes as well (?).

I currently see no way how to use {{< figure … in a project if it is not guaranteed that the project will be (and stay) in the root.

Looks like recreating the figure shortcode in the template for the project the only way…


That is the only way. If you need something more than what an internal shortcode already offers, you recreate it