Open Yamavu opened 1 month ago
I just ran into this as well.
as far as I understood, _get_url ( path, lang="en", trailingslash=false, cachebust=false ) is also used internally which is why is simple and optimized.
the function currently supposed to only work with MD files, not the page assets (even though the documentation suggests that).
The function has a fallback option to also link to the static directory, and happens to work with un-sluggified content nodes too. It feels pretty alpha to me
Basically it's for 2 things:
@/
, resolve the internal linkTo handle 2 for assets with renamed slugs, it would require detecting it's a colocated asset, load the related page and generate the permalink from there (what you need to load exactly in the GetUrl fn is TBD, you don't want to add the whole site). If someone wants to do a PR for that I would take it.
Documentation issue
Summary
Listing all colocated assets of a page in a template
page.html
. The contentindex.md
uses a slug(tested on versions 0.18.0 and 0.19.1)
Files linked in markdown are unaffected.
file setup:
From the documentation:
If the page also uses a custom slug variable,
{{ get_url(path=asset) }}
doesn't provide this correctly,Zola will only display the right output when the link is written like:
Maybe I overlooked something, but linking all co-located assets seems to be quite essential for building almost any kind of art or photo gallery.
Proposed solution
Either current documentation should be expanded or get_url() should include this functionality.