Skip to content
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

Cachebusting breaks get_url path lookup for JS asset in theme #1416

Closed
adworacz opened this issue Mar 20, 2021 · 0 comments
Closed

Cachebusting breaks get_url path lookup for JS asset in theme #1416

adworacz opened this issue Mar 20, 2021 · 0 comments
Labels
bug done in pr Already done in a PR

Comments

@adworacz
Copy link

Bug Report

Environment

Zola version: 0.13.0

Expected Behavior

get_url(path="assets/js/main.js", cachebust=true) should work in a theme, since cachebust=false works.

Current Behavior

An error when running zola build occurs:

Failed to build the site
Error: Failed to render page '/home/user/Documents/blogs/blog/content/post.md'
Reason: Failed to render 'page.html': error while rendering macro `footer::script` (error happened in a parent template)
Reason: Function call 'get_url' failed
Reason: file `assets/js/main.js` not found; searched in /home/user/Documents/blogs/blog/static /home/user/Documents/blogs/blog/public /home/user/Documents/blogs/blog/content

It looks like get_url is not searching inside the theme's directory.

Step to reproduce

Utilize this commit/branch from the zerm theme: adworacz/zerm@caa3d04

Alternatively, a theme that loads JS from a similar directory should suffice for testing the error with cachebust=true

@adworacz adworacz changed the title Cachebusting breaks get_url path lookup for JS asset Cachebusting breaks get_url path lookup for JS asset in theme Mar 20, 2021
adworacz added a commit to adworacz/zerm that referenced this issue Mar 20, 2021
This allows users to set extremely high caching values for their CSS and
assets without worrying about poor UX whenever an update to said
assets is made.

Note: Can't add this for JS assets yet, the cachebusting logic is
broken, see getzola/zola#1416

Ref:
* https://www.getzola.org/documentation/templates/overview/#get-url
* getzola/zola#519
@Keats Keats added the bug label Mar 20, 2021
@Keats Keats added the done in pr Already done in a PR label Jun 24, 2021
@Keats Keats closed this as completed in 545e766 Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug done in pr Already done in a PR
Projects
None yet
Development

No branches or pull requests

2 participants