I’ve been having some trouble reliably linking to other pages or images in Markdown (Kirbytext). I am demoing Kirby right now and while I think I understand it pretty well (I’ve created some complex templates, tags, etc in just a couple of days), maybe I am missing something obvious.
In general, the site is fairly complex, with a deep nested structure.
If I am very deep in the structure and I want to link to another branch of the tree, I’d normally use a root path rather than a relative path to get there.
Simple enough. Kirby, however, doesn’t generate a proper link for that. The link is generated from the root of my entire server, not from the root of the kirby project.
That is, instead of generating a link:
Clearly, not what I want.
A similar, but somewhat odder, issue cropped up when I attempted to use basic Markdown image links rather than Kirby’s (image) links:
For example, iirc,
will fail with a similar problem to normal links (not going where is should under the root), but
I’m a little worried, as I was thinking Kirby was doing gang-busters for this evaluation until I came upon this while building up the content of the site.
To put a slight wrinkle in it. If I ASK Kirby’s $page object (which I do, to generate related pages links) if
For example, I have code that looks like this:
(not real code, stuff removed for clarify)
$rps = $page->related()->pages(); foreach ($rps as $p) <a href="<?php echo $p->url() ?>"><?php echo $p->title()->html() ?></a>
Where the Related: field in a page looks like:
is a valid page, it will say yes and return the correct page. This works fine.
This really seems to be embedded in the Markdown/Kirbytext processing, but…I dunno.