Closed
Description
Bug Report
Environment
Zola version: 0.16.0 (macOS)
Expected Behavior
Calling get_url(path=X)
with X
being the path to a page asset should correctly create a resolvable URL. This should be true even for pages that have a date specified as part of their directory name. For example, for page 2022-07-29-post/index.md
with a page asset img.jpg
, calling get_url(path="/2022-07-29-post/img.jpg")
should lead to the URL https://example.com/post/img.jpg
.
Current Behavior
Currently, for a page 2022-07-29-post/index.md
with a page asset img.jpg
, calling get_url(path="/2022-07-29-post/img.jpg")
leads to the unresolvable URL https://example.com/2022-07-29-post/img.jpg
.
Step to reproduce
-
In an empty directory, create a simple site:
echo 'base_url="https://example.com"' > config.toml mkdir -p content/2022-07-29-post templates touch content/2022-07-29-post/img.jpg cat > templates/page.html <<EOF {% for asset in page.assets %} <a href="{{ get_url(path=asset) }}">click</a> {%- endfor %} EOF cat > content/2022-07-29-post/index.md <<EOF --- title: Test --- EOF
-
Run
zola build
-
Check the contents of
public/post/index.html
. It should contain<a href="https://example.com/post/img.jpg">click</a>
but contains
<a href="https://example.com/2022-07-29-post/img.jpg">click</a>