Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Header Image Path #415

Closed
julie-de-ville opened this issue Oct 18, 2024 · 6 comments
Closed

Header Image Path #415

julie-de-ville opened this issue Oct 18, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@julie-de-ville
Copy link

julie-de-ville commented Oct 18, 2024

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

@julie-de-ville julie-de-ville added the bug Something isn't working label Oct 18, 2024
@welpo
Copy link
Owner

welpo commented Oct 18, 2024

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" }
+++

@julie-de-ville
Copy link
Author

julie-de-ville commented Oct 19, 2024

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.'

@julie-de-ville
Copy link
Author

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.

@welpo
Copy link
Owner

welpo commented Oct 19, 2024

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!

@julie-de-ville
Copy link
Author

That worked, thanks!

@welpo
Copy link
Owner

welpo commented Oct 19, 2024

Happy to hear!

@welpo welpo closed this as completed Oct 19, 2024
Repository owner locked and limited conversation to collaborators Oct 19, 2024
@welpo welpo converted this issue into discussion #417 Oct 19, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants