Comments (4)
Thanks @goingforbrooke -- much appreciated!
from zola-theme-terminimal.
Initial findings
Using page.colocated_path
in the image.html
shortcode fixes the issue for (@ipetkov's) post-directory style, but breaks images for the post-markdown style (where images are stored in static/
).
Fix Attempt
terminimal/templates/shortcodes/image.html
...
{# ... then convert the page's colocated_path ident to a string so it can be concatenated. #}
{% set page_path = page.colocated_path | as_str %}
{# ... and prepend the site's base URL to the image's URL. #}
{% set src = config.base_url ~ page_path ~ src %}
...
Fix Notes
I had to use as_str
on page.colocated_path
to prevent a concatenation error.
Error: Reason: Tried to concat a value that is not a string or a number from ident page.colocated_path
The page.colocated_path
shortcode variable only has the name of the post's parent directory, so we still have to use config.base_url
to get the full path to the image. I'm probably missing something about asset search paths and shortcodes, but Zola's issues show that I'm in good company-- the docs for shortcodes were updated just seven hours ago.
Next Steps
Zola promises the same asset-finding logic between markdown-post and directory-post styles. Maybe the shortcode needs some conditional logic for post-directory and post-markdown styles?
from zola-theme-terminimal.
Actually, this fix only breaks post-markdown style images if a mix of the two styles are used. As long as I stick to post-markdown or post-directory for the content of a post, everything's fine. It's almost as if Zola takes the first image shortcode as its cue for where it should look for images in the rest of the blog post.
It's not pretty but is that a satisfactory fix for now, @pawroman?
from zola-theme-terminimal.
Created a draft PR with the fix.
from zola-theme-terminimal.
Related Issues (20)
- code blocks should scroll horizontally if they exceed the content width HOT 3
- Fail to build when the first menu item is different than $BASE_URL HOT 2
- Use post title as page title HOT 1
- Post view navigation broken in zola 0.16 HOT 2
- add support for extra.stylesheets HOT 2
- Add website source as a footer setting HOT 5
- How do I get the archive to generate? HOT 2
- Is it Possibly to add an abstract display in blog HOT 4
- Bug: image shortcodes work in `zola serve` but not `zola build` HOT 1
- Bug: setting `logo_home_link` in `config.toml` has no effect
- figures don't center
- Variable 'config.extra.page_titles' not found in context while rendering 'macros/title.html' HOT 4
- Does terminimal support RSS 2.0? HOT 1
- Support ATOM feeds
- Is it possible to overwrite the font? HOT 5
- Config option for disabling post summaries? HOT 2
- Is it possible to add like more text to the index page? HOT 3
- Is this theme abandoned? HOT 4
- add support for 'Table of Contents'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zola-theme-terminimal.