Hi, I noticed that the ref
is not working with relative paths since v0.123.0, Iβm not sure if this is by designed or should be considered as a bug.
[link]({{< ref "../../k8s-on-raspi" >}})
Hi, I noticed that the ref
is not working with relative paths since v0.123.0, Iβm not sure if this is by designed or should be considered as a bug.
[link]({{< ref "../../k8s-on-raspi" >}})
I assume something like this:
content/
βββ s1/
β βββ s2/
β β βββ s3/
β β β βββ _index.md
β β β βββ p1.md
β β βββ _index.md
β βββ _index.md
β βββ k8s-on-raspi.md <-- you want to get here from s1/s2/s3/p1.md
βββ _index.md
Is that correct? If so, itβs working for me:
git clone --single-branch -b hugo-forum-topic-48939 https://github.com/jmooring/hugo-testing hugo-forum-topic-48939
cd hugo-forum-topic-48939
hugo server
hugo v0.124.1-db083b05
Since v0.123.0, the functions and methods that resolve pages (including the ref
and relref
shortcodes) look for the logical path. See https://gohugo.io/methods/page/path/.
Thanks for spending time on this, I modified the structure for reproducing the issue, seems related to page bundle.
Your screen shot shows
[link]({{< ref "../../../k8s-on-raspi" >}})
But you originally reported
[link]({{< ref "../../k8s-on-raspi" >}})
Which is it?
[link]({{< ref "../../../k8s-on-raspi" >}})
Iβm sorry I didnβt make myself clear, the above is the right one for this branch. The original one was copied from different structures (depth 2).
Please see my initial response⦠use the logical path as described in the docs.
content/
βββ s1/ --> k8s-on-raspi.md brings you to your destination
β βββ s2/ --> ../ brings you to s1
β β βββ s3/
β β β βββ _index.md
β β β βββ p1.md --> ../ brings you to s2
β β βββ _index.md
β βββ _index.md
β βββ k8s-on-raspi.md
βββ _index.md
The original structure is OK, what about the following structure.
content
βββ _index.md
βββ s1
βββ _index.md
βββ k8s-on-raspi
β βββ index.md
βββ s2 --> ../ to s1
βββ _index.md
βββ s3 --> ../ to s2
βββ _index.md
βββ p1 --> ../ to s3
βββ index.md
And I modified the path as follows.
// content/s1/s2/s3/p1/index.md
[link]({{< ref "../../../k8s-on-raspi" >}})
No. The LOGICAL path is different from the file path. See the documentation!
Thanks.
Just as file paths form a file tree, logical paths form a logical tree.
Thatβs the first sentence. And what a βlogical pathβ is, is never clearly defined. This sentence is kind of circular, referring to another concept. It should explain the new one. Something like
βA logical path considers directories/folders and content files in the same immediate parent directory/folder as path components on the same level.β Or whatever correctly describes the concept (since I donβt quite understand it, I canβt proposed a good definition).
Maybe this one ma help
Kind of. But I stll think that the definition of a concept should appear (also) at the place where the concept is introduced (and the example the glossary of the term refers to does not illustrate all the facets, like spaces being replaced by dashes and lowercasing the names).
The right word to use in these definitions would be βnodeβ, showing a βnode treeβ example, then describing the logical path as the path between two nodes, either relative to each other or absolute from the root of the tree.
Every time Iβve encountered a concept like this it is called a βnodeβ.
Unfortunately, a very long time ago, Hugo limited the definition of node to page kinds home
, section
, taxonomy
, term
, 404
, and maybe some others, but the definition excludes page kind page
.
https://gohugo.io/methods/page/isnode/
Iβve wanted to deprecate this for a long time because the definition doesnβt make any sense.
https://github.com/gohugoio/hugo/issues/11574
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.