Open madhead opened 1 year ago
This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master
branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.
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 https://github.com/gohugoio/hugo/blob/f7e00c039ff3cea5f991b05c1e325666004cf129/markup/asciidocext/convert.go#L161 the path is pretty rigidly tied to the
filepath.Dir(ctx.DocumentName)
orfilepath.Dir(ctx.Filename)
.