Closed nobody4t closed 2 years ago
Is the code public, or can you provide a minimal reproducable example. I've never had a problem like that. Just would be curious to replicate it (and of course see if I can tell you the answer to your question).
OK. I got some problems that I can not figure them out the cause. I am using blow theme. https://github.com/tchartron/blow
[extra.index]
title = "me"
image = "images/me.png"
image_alt = "me"
[extra.default_author] name = "my name" avatar = "images/me.png" avatar_alt = "my name"
The images dir is under static. And the image in extra.index can be displayed in my web. But the avatar can not. The avatar_alt will be displayed instead.
I inspected the html in the web and the path is right. I am not sure what happened.
Edit:
I build the project and found the html lines for them:
index image: avatar:
So only css is different. But I when use this link as a place holder in avatar it would be displayed properly as image.
I've not been able to reproduce the problem. Where do you see the error message? I've created a repo based on the info you provided please check it and see if you still get the error when you use what I tried please, or see how they are different.
@c-git I have a PR for your test repo and I restore my env. Please find the home page where the image is displayed. But in the blog/hello page the avatar is not displayed well.
I'm a bit confused. I thought the original problem had something to do with
which doesn't exist or isn't loaded
However, you last post doesn't seem to have anything to do with a missing file.
Anyway based on your last message I merged your PR but am not sure what problem you are referring to. I tried the site and it looks ok to me. But the problem you are describing sounds more like something to do with the theme rather than zola. If you are referring to the head in the box in the screen shot below that doesn't look like an error. It looks like an svg and intentional rather than an accident, but not being familiar with the theme I am unable to speak to their intention.
@c-git with your screenshot, I think you missed it. You can see I set the same path and same image here and here
The first path(index) is for the home icon the second(default_author) is for the avatar bsides the name of default autor. But the image in the home is displayed but not the avatar image. Look at my screenshot bebelow: The "my name" is alt text now. Please see the code.
I did not say it is the problem of zola. But As I found when I inspect the html element from browser, the image path is good. Both them are the same. And the template code is good. I am not sure what is the problem.
TLDR; Put a "/" before the filename and that should fix your problem.
Ok now that I understand what you mean I was able to figure it out. Upon inspecting the HTML I saw that it said default_author.png
but the page was in a sub folder so it would be relative and the file does not exist in that sub folder. At first I wasn't sure if it had anything to do with zola serve
so I decided to use github pages to test it but that proved challenging as the theme uses absolute links to the css (<link href="/css/main.css" rel="stylesheet">
note the "/" in the href). So I changed the repo name to make it serve without using a folder and then it looked ok. Once I'd done that I was able to start debugging the problem more and found that making the link absolute makes it work by adding "/" before the filename. Unfortunately, I won't be able to leave that repo around for long as it uses the only one you are allowed by github that doesn't use a folder. But I won't need it in less that a week so you should have a chance to take a look if that suits your fancy.
@c-git Thanks for your work. I omit the "/", and the home page works. Then I think it would be OK. I think I missed the lines in doc
Or you could save the image to some arbitrary directory within the static directory. For example, you could save all images to
static/images. Using this approach, you can no longer use relative links. Instead, you must use an absolute link to
images/[filename] to access your image.
Well here the example also omit the slash before images. I could have missed the lines and just directly to the example. This may be worth being changed? Any way thanks for the work.
Sorry, one more question regarding: {:target="_blank"}. In markdown, I use this to point to a new tab in browser. But in zola, it looks like a normal feature. You can see from the screeshot. zola does not know it, and it fail to take effect.
I didnot find this in the doc. Any idea about this?
I haven't made a search for it yet but I would like that as well. It's not a part of CommonMark (I'd not actually heard of the extension before to choose the target type). Zola does support a bit more than the basic spec but I'm not aware of any way to do that.
That's not a CommonMark feature, it must be a specific feature from whatever implementation you were using. You can set some options for external links in the config, search for external_links in https://www.getzola.org/documentation/getting-started/configuration/
@Keats
I think you mean this: external_links_target_blank = true
right?
This is from the doc.
# Whether external links are to be opened in a new tab
# If this is true, a `rel="noopener"` will always automatically be added for security reasons
external_links_target_blank = false
But when I set it no matter true of false. The thing I expected does not happen. And I see from the web the html element does not change from false to true. No new tab opened.
@Keats I think you mean this:
external_links_target_blank = true
right? This is from the doc.# Whether external links are to be opened in a new tab # If this is true, a `rel="noopener"` will always automatically be added for security reasons external_links_target_blank = false
But when I set it no matter true of false. The thing I expected does not happen. And I see from the web the html element does not change from false to true. No new tab opened.
Can you update the repo with an example? I tried it and it worked for me.
@c-git pease find the PR.
I saw it and fixed the problem. It has to be inside of the markdown section for it to work. See working example: https://c-git.github.io/blog/hello/
@c-git Thanks so much for your support. I am OK now.
No problem. Glad to help.
I try to extend some theme. The extend file is not loaded and I want to know more info about the issue. How can I get more like debug info from zola?