Is there a way to generate a valid URL from asciidoc link:file.adoc[title]

I have a hugo project structure like this:

content/
   _index.md
   a.adoc
   b.adoc

There is a cross-reference to the a.doc in b.adoc

link:a.adoc[The page "a"]

Hugo renders the link to the URL like this: site_url/a.doc
But this page doesn’t exist and i get 404 when going to the URL. The valid URL is site_url//a

Is there a way for generating a valid URL like above? There may be a solution similar to markdown-render-hooks?

layout
  _default
    _markup
       render-link.html

I found this way:
link:{{< ref "_somefile_.adoc" >}}[_link text_]
but in this case, the adoc syntax breaks and the link becomes non-clickable on github

Render hooks… no.

https://gohugo.io/getting-started/configuration-markup/#markdown-render-hooks

Note that this is only supported with the Goldmark renderer.

But this might work for you:

:relfileprefix: ../
:relfilesuffix: /

xref:a.adoc[foo]

https://docs.asciidoctor.org/asciidoc/latest/macros/inter-document-xref/

@jmooring it works!
thank you very much for your help!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.