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
theme: local images broken in 5.26.0 #805
Comments
Update: It worked with the exampleSite of the theme in this configuration. The reason I first confirmed it was due to the reason that I used the built-in Anozher update: Five hours ago Hugo 0.124.0 fixed this in its shortcode. So everything works for me. @cagix: Could you give me access to your MWE? Anyways, thanks for reporting. |
In your repo you are using this on the specific page:
Also I don't see any It might work, if not following Hugo's requirements but in my experience this is a bad idea as it will fire back at some future point in time. So in your case it might be a Hugo "issue", so try to revert back to 0.122.0 to see if this changes anything. |
oh, you found my repo 🙃 indeed, the structure i'm using here is intended to be read by humans (via gh-preview), and is definitely not hugo compatible. to produce the website, i do a little preprocessing. during this step all i've seen the hugo update yesterday after my posting, and will give it a try tomorrow. if this does not resolve my issue, i'll prepare a proper mwe and give you access.
thx for this advice, will give it a try. |
@McShelby Unfortunately, even after updating to Hugo v0.124.0 and Relearn v5.26.1, the issue is still the very same. I have tried it locally and on our LMS. As promised, here is an MWE: https://github.com/Programmiermethoden-CampusMinden/mwe-hugorelearn (you should have write access) The <a href="#R-image-e6da6145af2b42742fdd08ac9c5f43fe" class="lightbox-link">
<img class="noborder lazy lightbox noshadow figure-image" loading="lazy" src="file://PATH/mwe/docs/PATH/mwe/docs/ki_fahrplan_2023-2024.png?width=80%25&height=auto" style=" height: auto; width: 80%;">
</a> (formatted manually to improve readability) Edit: ARGH. I've just realised that the local path actually appears twice in the Edit: Can confirm, that this also happens for a <a href="#R-image-ea63cd67d65e6ede4b453c9c0fc0b371" class="lightbox-link">
<img class="noborder lazy lightbox noshadow figure-image" loading="lazy" src="https://www.hsbi.de/elearning/data/FH-Bielefeld/lm_data/lm_1358898/elearning/data/FH-Bielefeld/lm_data/lm_1358898/ki_fahrplan_2023-2024.png?width=80%25&height=auto" style=" height: auto; width: 80%;">
</a> You can see, the part |
Can confirm, with Hugo v0.122.0 and Relearn v5.26.1 everything works as expected. |
@McShelby Would you agree that this is a Hugo problem? Should I open a new issue in the Hugo repo? |
v0.123 startet to handle the baseURL wrong - local images won't be resolved properly see McShelby/hugo-theme-relearn#805
v0.123 startet to handle the baseURL wrong - local images won't be resolved properly see McShelby/hugo-theme-relearn#805
Let me first take a look into it (will most likly happen this evening) before you post an error for Hugo. I know there was a change regarding how links are anchored and I first have to take a look into it myself. From my guts I still think it's a configuration isssue with your site but we'll see if this is really the case. |
From my first look into the repo I noticed |
@McShelby I have been experimenting with my Hugo configuration just now. The culprit is clearly I'm not sure why I activated this option in the first place. If my memory serves me right, I had to use That being said, I find it disturbing that Hugo is constantly making API changes and deprecating things - and in this case not even issuing a warning. |
Previously in the theme docs, I recommended Now that the theme only supports Hugo 0.112.4 or higher, this does not seem to be necessary anymore. |
Btw: I recently updated the section for usage scenarios in the docs. |
thx! reading the warning regarding webserver + subdirectory, maybe this was the reason for me using edit: @McShelby your info in the link above regarding
it would be great, if in the |
It should. If not, it's either a bug or the page/resource was not found by link resolution. You can check if resultion was successful by adding
|
wow. interesting. now hugo is yelling at me:
but if i understand this output correctly, it complains about a but this error aside - maybe the theme does not resolve this link properly because i'm relying on the hugo magic to resolve a resource by name - in this case it should (and will) find this file: |
The error might come that this was TOML syntax not YAML syntax? |
uhm, i translated this into
|
🙈 that would do w/o the dashes ... so, now it's more regarding links:
strangely, there is a page edit: also in |
Hugo can be - ehh - quite challenging (to say politely). I recommend getting rid of the This may lead to other issues as I think using "the hugo magic to resolve a resource by name" will not work with plain markdown links. The reason your build fails is due to your configuration to treat warnings as errors (which I generally find a good thing). To fix all those link issues it is helpful to deactivate this behavior until all links are fixed. |
🤣
Unfortunately, in my workflow there is currently no viable alternative, as my pre-processing step moves and renames files (a lot) to be compliant w/ Hugo. It would be serious overhead to calculate and track all the new paths, that's why I'm relying on Hugo's magic here :) But maybe I should tackle this problem and expand my pre-processing. Alas, life is short and so is time :) |
yeah, i thought, we are tracking down, why the relearn theme does not append an |
Sure, but if the build fails with the first warning, it may be a bit time consuming as the list of warnings may not be complete for the whole site. So you would need to fix each link and restart the build afterwards until Hugo finally runs without failure. Quite time consuming. |
To sum it up:
For the second point, the best would be to have an repository in the form right before Hugo runs thru it. I don't care about superflous files. The closer it is to your real environment, the better for me to test. |
✅ (actually, that is removing
I've upgraded my MWE to be a real live example. Please find it here: https://github.com/Programmiermethoden-CampusMinden/mwe-hugorelearn You will find the files from https://github.com/Artificial-Intelligence-HSBI-TDU/KI-Vorlesung after the pre-processing step, i.e. this is actually the input presented to Hugo. If you run Hugo on the project, you will find, that with |
Okay, I found the reason for this behavior but am not sure what to do next. So first: There is no bug neither in the theme nor in Hugo. It works correct in terms of its limitations. If you are using ref/relref Hugo resolves those links to URLs. Because you have defined a The render hook tries to resolve this to a page but fails, because the lookup is only allowed for the so called When the lookup fails, two things happen:
So the main question is: Are you dependend on the appended |
@McShelby thx for your detailed analysis 🙏
our ilias cannot handle non-ugly urls, i.e. i depend on the appended so i guess, i'm stuck to from my point of view this issue can be closed. thx again for your time and your amazing work 👌 |
Thanks for using the theme! |
this won't work in combination w/ `canonifyURLs`, see McShelby/hugo-theme-relearn#805
Just to let you know, it seems, that local images are broken in Relearn 5.26.0 / Hugo v0.123.8 in combination with "ugly url".
MWE:
File
_index.md
with just this content:Image
bar.png
living in the same folder as_index.md
...Using Hugo:
This will yield an empty box:
This used to work before, however I cannot say for sure if this is from the last Relearn update or earlier.
The text was updated successfully, but these errors were encountered: