-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
image related shortcodes don't work when page folders are prefixed with dates #436
Comments
I am not sure if this issue should be fixed in tabi or if it should be fixed in zola Maybe adding a I can look into it if you think we should fix this issue in tabi. |
I just found the issue discussed in Zola: getzola/zola#2598. Feel free to close this issue if you would prefer having it fixed in Zola (even if I expect a few impacts on tabi anyway). |
Thanks for the thorough report and the .zip with a reproducible example! Top tier bug reporting here. I ran into this issue when trying to fix #392 (in #432): setting a Looking into this, I do not think it can be fixed without adding an argument (as you proposed) to the shortcodes. To me, it makes more sense to fix - {%- if src is starting_with("http") -%}
+ {%- if src is starting_with("http") or raw_path -%} What do you think makes most sense? |
Meanwhile, I tried to propose a fix for Anyway, introducing I can look into it if you want. |
I've implemented it in #439. Could you test it? :) |
I confirm it works well. Before merging, don't forget you have enabled csp in Hopefully, we'll be able to get rid of raw_path in this case at some point. I consider this issue resolved so feel free to close it whenever you want. |
Thanks for catching that! Fixing it and merging :) |
System information
Zola version: 0.19.2
tabi version: 3.1.0
Expected behaviour
Zola allows to prefix pages with dates which will be used as the creation date of the page (https://www.getzola.org/documentation/content/page/).
This makes the relative path to the file in the source different from the path in the public folder.
I would expect image shortcodes to use the output image URL (i.e. with date stripped) instead of the source file path.
As an example, if we take the following page having a collocated image:
Assuming we are testing locally, I would expect images shortcode to point to:
http://127.0.0.1:1111/blog/a-page/my-image.webp
Actual behaviour
Images colocated in a page folder prefixed with creation date have an incorrect link and cannot be rendered.
Taking the previoulsy described structure, images shortcode to point to:
http://127.0.0.1:1111/blog/2024-11-23_a-page/my-image.webp
which doesn't exist.Steps to reproduce
image-shortcode-issue.zip
Unzip this small website, add tabi as theme and just run
zola serve
on it.Browse the two pages (one prefixed and the other not).
Additional context
Issue comes from using
page.colocated_path
for relative path which is related to source files and is not aware of the output path.Only
page.path
is valid but it cannot be used withget_image_metadata
.Last but not least, it would work if the provided path (e.g.
my-image.webp
in our case) was used raw (i.e. withoutget_url
) as the browser is only aware of the output path.Final checklist
The text was updated successfully, but these errors were encountered: