Open WaffleLapkin opened 3 years ago
Hm, though the same problem occurs with static/
... Maybe I don't understand what get_url
is supposed to do?..
I stumbled here while using get_url
to retrieve a static asset. My issue is not related to render = false
though.
get_url
documentation says:
This can also be used to get the permalinks for static assets, for example if we want to link to the file that is located at
static/css/app.css
:{{ get_url(path="static/css/app.css") }}
though, this is not working because if I do so, the returned URL is (in zola serve
) http://127.0.0.1/static/css/app.css, which is not correct since the static
content will be placed in the root.
In the file searching logic section, it is mentioned this:
Search in the following locations in this order, returning the first where the file exists:
$base_directory + $path $base_directory + "static/" + $path $base_directory + "content/" + $path $base_directory + $output_path + $path $base_directory + "themes" + $theme + "static/" + $path (only if using a theme)
In the example, $base_directory + $path
where $path = static/css/app.css
is correct and finds the file, but the produced URL is not correct.
For get_url
with assets you're meant to pass css/app.css
without the static
name in it so {{ get_url(path="css/app.css") }}
which should generate the right path. The documentation probably needs to be updated
Bug Report
Consider the following structure:
_index.md
:get_url(path="/pages/about/picture.jpg")
returns$BASE_URL/pages/about/picture.jpg
, but the picture is located atpublic/about/picture
.Environment
Zola version:
0.14.0
Expected Behavior
get_url
return reachable URL ($BASE_URL/about/picture.jpg
)Current Behavior
get_url
return unreachable URL ($BASE_URL/pages/about/picture.jpg
)Step to reproduce
Create said structure, call
get_url
.