Set outdir
(imagesoutdir
) to the slugified value when rendering AsciiDoc diagrams.
#10183
Labels
outdir
(imagesoutdir
) to the slugified value when rendering AsciiDoc diagrams.
#10183
I have a small Hugo site using AsciiDoc (sources). I want to add diagrams to it.
This page helps a lot to set them up: https://gohugo.io/content-management/formats. What I have to do to get the diagrams working, is just adding a few lines to the
config.yml
:After that the diagrams mostly work, but I've noticed an issue.
Take a look at this page:
content/wiki/3D printing/_index.adoc
. It's path on the filesystem is not slug-friendly: it contains spaces and upper case characters.Hugo renders this page into a file named
public/wiki/3d-printing/index.html
. Basically, the path is slugified.However, when it calls
asciidoctor-diagram
, theoutdir
is different and corresponds to the original*.adoc
file path:Note this:
base-dir
:/home/madhead/Projects/wiki/content/wiki/3D printing
outdir
:/home/madhead/Projects/wiki/public/wiki/3D printing
As a result, I have two directories now:
What's even worse, is that the resulting HTML page is incorrect: it refers the image as if it were in the same directory:
As you might guess, the diagram is not shown on the page.
This issue exists only when the path of page source (the
*.adoc
file) is different from the resulting slug. If the page path is the same as it's own slugified path, then everything works correctly.Is it possible to tune this behavior? I'd prefer the diagrams be rendered into slugified directories.
Reading the code didn't help me a lot, looks like here
hugo/markup/asciidocext/convert.go
Line 161 in f7e00c0
filepath.Dir(ctx.DocumentName)
orfilepath.Dir(ctx.Filename)
.The text was updated successfully, but these errors were encountered: