You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
I am sorry to bring this topic up again. The behavior is still not solved with 0.17.x
I tried to find the root problem and I have the following theory:
When a page is created, the from_file() method from page.rs will be called and in this method the find_related_assets() method is called to find all assets. This will generate a vector with assets, which contain the path to the assets, in the case when a date is in the folder name, the date will also be in this path.
In order to see this I created a PR here: #2146
This PR prints the paths for each asset, in the case with the date in the folder it will look like this:
Bug Report
Environment
Zola version: 0.16.0 (macOS)
Expected Behavior
Calling
get_url(path=X)
withX
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 page2022-07-29-post/index.md
with a page assetimg.jpg
, callingget_url(path="/2022-07-29-post/img.jpg")
should lead to the URLhttps://example.com/post/img.jpg
.Current Behavior
Currently, for a page
2022-07-29-post/index.md
with a page assetimg.jpg
, callingget_url(path="/2022-07-29-post/img.jpg")
leads to the unresolvable URLhttps://example.com/2022-07-29-post/img.jpg
.Step to reproduce
In an empty directory, create a simple site:
Run
zola build
Check the contents of
public/post/index.html
. It should containbut contains
The text was updated successfully, but these errors were encountered: