Closed UzairQamarxyz closed 6 months ago
Hi @UzairQamarxyz, This doesn't look right. I have to check that.
I found the issue causing this.
It was this line in my hugo.toml
file.
assetDir = "static"
I had added this line because for some reason I keep getting this error without it.
ERROR The resource "/images/test.png" passed to the "figure" shortcode could not be found.
Here's the <figure>
in question.
{{< figure src="/images/test.png" caption="<span class=\"figure-number\">Figure 1: </span>Test Image" class="big" >}}
The image is located in static/images/test.png
Anyways this issue was invalid so I'll be closing it.
Hi @UzairQamarxyz,
Your resolution doesn't explain the issue completely. Why did you had to enter assetDir = "static"
, when assetDir is already set to assets
by default?
No idea tbh. I only started using Hugo 2 days back.
I just tried with a fresh hugo site and got the issue.
Here are the steps to reproduce:
hugo new site test
cd test
git init
git submodule add -b main https://github.com/1bl4z3r/hermit-V2 themes/hermit-v2
cp themes/hermit-v2/hugo.toml.example ./hugo.toml
#baseURL = "CHANGE BASE URL"
defaultContentLanguage = "en"
defaultContentLanguageInSubdir = true
theme = "hermit-v2"
...
# [params.author]
# name = "CHANGE SITE AUTHOR"
# about = "CHANGE SITE AUTHOR ABOUT"
mkdir content/posts/
echo '+++
title = "Test"
author = ["Test"]
lastmod = 2024-02-19T15:52:46+05:00
tags = []
draft = false
+++
{{< figure src="/images/test.png" class="big" >}}' > content/posts/test.md
assets/images/test.png
hugo server -D
Watching for changes in /home/uzair/Documents/test/{archetypes,assets,content,data,i18n,layouts,static,themes}
Watching for config changes in /home/uzair/Documents/test/hugo.toml
Start building sites …
hugo v0.122.0+extended linux/amd64 BuildDate=unknown
ERROR The resource "/images/test.png" passed to the "figure" shortcode could not be found. See "/home/uzair/Documents/test/content/posts/test.md:9:1"
Built in 21 ms
Error: error building site: logged 1 error(s)
Hi @UzairQamarxyz,
If I understand it correctly, an image file is in assets/images/test.png
and you are trying to get image from /images/test.png
.
You can correct me if I'm wrong, however when you do that, it signifies that there is a image in images
directory in root; but it isn't.
You may try to re-create the issue by editing figure shortcode as below
{{< figure src="images/test.png" class="big" >}}
Oh damn! I'm dumb :p
Can't believe I missed that. I was using ox-hugo to export my org
files to hugo compatible hugo mds, ox-hugo stores images in the static
folder instead of assets
and I didn't even notice that.
Thanks @1bl4z3r and sorry for the trouble!
No worries. It's something we all need to be careful about. Original hermit theme uses assets
directory for everything (well except for somethings 😅). Also hermit-V2 allows for on-the-fly conversion to webp for image media, so keeping images in assets became a necessity.
Hope this helps and hope that you would be using hermit-V2 in your future endeavors.
I keep getting the following error when trying to use a
userstyles.scss
file.I have my
userstyles.scss
file underassets/scss/
as per the README but I see thatuserstyles.scss
is being checked atassets/scss/userstyles.scss
and then it tries to importuserstyles.scss
from the project root.https://github.com/1bl4z3r/hermit-V2/blob/630960e61554ebfbd51102b2fbcc0449761167a8/assets/scss/style.scss#L9-L11
If I create an empty
userstyles.scss
inassets/scss/
folder and have the actual one at the project root then things work fine.