welpo/tabi

Header Image Path

julie-de-ville opened this issue · 6 comments

Bug Report

Environment

Gentoo linux
Zola version: 0.19.2
tabi version or commit: V3.0.0

Expected Behavior

Tell us what should have happened.

I cannot get the header image to display. I placed it in static/img, and set the path as img/image.png in my _index.md in content, but it still does not display. When visiting localhost:1111/img/image.png, it does display, but currently there is nothing except the img_alt text.

The only way I can get it to display is by specifying it in home_banner.html

Hello!

Can you share the exact content of the _index.md page?

Have you checked the network monitor (Firefox docs) to see what happens when it attempts to load the file?

Did you try to find the image in the public directory (after zola serve or zola build)?

I would try to replicate the demo first:

  • File in static/img/main.webp
  • _index.md content:
+++
title = "Latest posts"
sort_by = "date"
template = "section.html"

[extra]
header = {title = "title", img = "img/main.webp", img_alt = "alt" }
+++

I will try those suggestions, thank you. The demo image does not work.

+++
title = "Fixations"
paginate_by = 5 # Set the number of posts per page
template = "index.html"

[extra]
image_base_path = "img/"
header = {title = "text", img = "img/image.png", img_alt = "text" }
+++

The image does show up in the public directory

In network monitor, it shows up as 'blocked.'

I changed the first line in content-security-policy.html to content="default-src 'self'; img-src * data:;

How should I configure to allow for the image source, but in a more secure way? The image is in static/img in the root dir.

That's helpful!

You mentioned you visit a localhost URL. Is that the URL Zola provides when you run zola serve?

For me, it's http://127.0.0.1:1111. I just tested going to localhost:1111 and it loads, but has issues (like the image not loading).

Try removing the CSP and visiting the URL Zola returns upon zola serve. That should fix it!

That worked, thanks!

Happy to hear!