Skip to content
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

Image render hook vs the new embedded image render hook in 0.123 #1504

Open
baekgaard opened this issue May 1, 2024 · 2 comments
Open

Image render hook vs the new embedded image render hook in 0.123 #1504

baekgaard opened this issue May 1, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@baekgaard
Copy link

PaperMod provides a layouts/_default/_markup/render-image.html render hook.

However, in newer versions of Hugo (0.123 and beyond) a new embedded image render hook is also provided. I think this may be meant as a better way to manage resources in a multilingual setup, but I also found it useful to avoid canonifyURL in cases where the entire site/baseURL is not at the root (i.e. like in www.xxx.yyy/zzz).

The embedded image render hook needs to be manually enabled for some sites, but is automatically enabled for multilingual single-host sites in the default configuration.

It may not be obvious (when debugging) why the embedded image render hook is not accessible when the embedded link render hook works with PaperMod -- at least it took me some minutes to figure out why not all url's were rewritten correctly.

I'm wondering to which degree the render-image.html hook in PaperMod is needed, or if it could be made to work with the embedded image render hook when enabled somehow -- although I don't currently see a good solution for that? I guess it's mainly there to provide the alt text?

In my own site, I simply made the embedded image render hook explicit by replacing (and updating) the render-image.html file with the code of the embedded one.

@baekgaard baekgaard added the enhancement New feature or request label May 1, 2024
@jmooring
Copy link
Contributor

With the existing image render hook...
https://github.com/adityatelange/hugo-PaperMod/blob/3f50861a0ced88f9b614a43662edeb4c0bc45da8/layouts/_default/_markup/render-image.html

...page resources for non-default languages on a multilingual single-host site will not be found.

The only thing that the existing image render hook does is to add a lazy loading attribute. Either model the hook after Hugo's embedded hook, or remove it.

@adityatelange
Copy link
Owner

can do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants