Closed dpertin closed 2 years ago
The cross posting to Hugo bundle pages is not yet supported because the I need to create relref's to the bundles' dir names and not the file names (which will always be index or _index).
For now, please create hard coded cross references like [[/post/post2][Link to post2]].
I'll keep this issue open until I add support for cross referencing page bundles.
This same problem also happens when using one post per org file. The suggested workaround works in these cases as well.
Maybe related to https://github.com/kaushalmodi/ox-hugo/issues/395#issuecomment-842247911 ?
Linking to page bundle posts with content file names as _index.md or index.md is not yet supported. Until that gets supported, Hugo's relref
shortcode works pretty well.
We wouldn't want to use a Hugo shortcode directly in our Org source, so here's what you can do (ref: https://ox-hugo.scripter.co/doc/shortcodes/#org-macros).
relref
#+hugo_base_dir: ../
#+hugo_section: /
#+macro: relref @@hugo:[@@ $1 @@hugo:]({{< relref "$2" >}})@@
* Articles
:PROPERTIES:
:EXPORT_HUGO_BUNDLE: articles
:EXPORT_FILE_NAME: _index
:END:
Content in a branch bundle
* Blog posts
:PROPERTIES:
:EXPORT_HUGO_SECTION: posts
:END:
** Post 1
:PROPERTIES:
:EXPORT_HUGO_BUNDLE: post-1
:EXPORT_FILE_NAME: index
:END:
Content in a "post-1" *leaf* bundle
- Link to {{{relref(Articles Section,articles)}}}
- Link to {{{relref(Post 2,post-2)}}}
** Post 2
:PROPERTIES:
:EXPORT_HUGO_BUNDLE: post-2
:EXPORT_FILE_NAME: index
:END:
Content in a "post-2" *leaf* bundle
- Link to {{{relref(Articles Section,articles)}}}
- Link to {{{relref(Post 1,post-1)}}}
_See https://ox-hugo.scripter.co/doc/hugo-bundle/ for info on EXPORT_HUGO_BUNDLE
._
Of course, it's the user's responsibility that the branch and leaf bundle names are unique.
This now works!!
#+hugo_base_dir: .
#+hugo_section: /
* Articles
:PROPERTIES:
:EXPORT_HUGO_BUNDLE: articles
:EXPORT_FILE_NAME: _index
:END:
Content in a branch bundle
- Link to [[*Post 1]]
- Link to [[*Post 2]]
* Blog posts
:PROPERTIES:
:EXPORT_HUGO_SECTION: posts
:END:
** Post 1
:PROPERTIES:
:EXPORT_HUGO_BUNDLE: post-1
:EXPORT_FILE_NAME: index
:END:
Content in a "post-1" *leaf* bundle
- Link to [[*Articles]]
- Link to [[*Post 2]]
** Post 2
:PROPERTIES:
:EXPORT_HUGO_BUNDLE: post-2
:EXPORT_FILE_NAME: index
:END:
Content in a "post-2" *leaf* bundle
- Link to [[*Articles]]
- Link to [[*Post 1]]
Hey! This is my first issue here, so I would like to thank you for this amazing project :+1:
Now regarding my issue, here is the context. Since I use the academic theme I export each subtree in an
index.md
file stored in different directories. Thus, each subtree has the following properties:And in this example, the exported file is stored in
content/post/post1/index.md
which works well :+1:.Now, I create a new subtree with a custom ID:
and I want to add a link in the first subtree, referencing the second one, as follows:
[[#post2][Link to post2]]
.However, the exported result is the following:
[Link to post2]({{< relref "index" >}})
which fails since it should be[Link to post2]({{< relref "post/post2" >}})
. The result is thus based onEXPORT_FILE_NAME
while I want it to be based onEXPORT_HUGO_SECTION
. Am I doing something wrong?