alshedivat / al-folio

A beautiful, simple, clean, and responsive Jekyll theme for academics
https://alshedivat.github.io/al-folio/
MIT License
11.37k stars 11.29k forks source link

Vector images not generating webp files #2660

Closed KingHowler closed 2 months ago

KingHowler commented 3 months ago

Have you checked that your issue isn't already filed?

Bug description

al-folio doesn't convert ".svg" files to ".webp" files. ".svg" files are small and their quality isn't lost when being displayed so not converting it is the best option. I should also mention that the images are displayed on the website without any faults. The issue which I want to bring forth is the error logs. The workflow "Check for broken links on site" produces an error log which should not be generated.

How to reproduce the bug

Error messages and logs

✗ [ERR] file:///home/runner/work/kinghowler.github.io/kinghowler.github.io/_site/assets/img/dec/logic-gates/NOR.svg-800.webp | Failed: Cannot find file

What operating system are you using?

Not applicable (e.g. you're using GitHub Pages or other hosting)

Where are you seeing the problem on?

Deployed site

More info

I suggest to create an exception case to not search for converted .svg files

george-gca commented 3 months ago

If it looks for converted svg files it means that the jekyll-imagemagick plugin is "converting" svg files. By converting I mean it is at least creating the tags with the .webp extension, since the Check for broken links on site workflow gets the links straight from the built site.

How are you adding the svg image to the post? Using figure.liquid?

KingHowler commented 3 months ago

Yes I am using figure.liquid

In the deploy workflow's log, there is a section which tells each image converted.

I have multiple images and Imagegick is converting all of them, but there is no log for any of my svg files which leads me to believe they are ignored when generating images.

george-gca commented 3 months ago

If you check

https://github.com/alshedivat/al-folio/blob/de4e89d11b44ca2b1660aeeafde5e88b6415542f/_includes/figure.liquid#L17

it creates a source to a .webp image even though none was generated. I believe we should add a check if the extension is not one of the ones in

https://github.com/alshedivat/al-folio/blob/de4e89d11b44ca2b1660aeeafde5e88b6415542f/_includes/figure.liquid#L1

and if it is not, don't add .webp source. If you manage to fix this, can you send a PR?

KingHowler commented 3 months ago

If you check

https://github.com/alshedivat/al-folio/blob/de4e89d11b44ca2b1660aeeafde5e88b6415542f/_includes/figure.liquid#L17

it creates a source to a .webp image even though none was generated. I believe we should add a check if the extension is not one of the ones in

https://github.com/alshedivat/al-folio/blob/de4e89d11b44ca2b1660aeeafde5e88b6415542f/_includes/figure.liquid#L1

and if it is not, don't add .webp source. If you manage to fix this, can you send a PR?

Ok will look into it

KingHowler commented 3 months ago

If you check

https://github.com/alshedivat/al-folio/blob/de4e89d11b44ca2b1660aeeafde5e88b6415542f/_includes/figure.liquid#L17

it creates a source to a .webp image even though none was generated. I believe we should add a check if the extension is not one of the ones in

https://github.com/alshedivat/al-folio/blob/de4e89d11b44ca2b1660aeeafde5e88b6415542f/_includes/figure.liquid#L1

and if it is not, don't add .webp source. If you manage to fix this, can you send a PR?

Ok will look into it

The faulty </source> tags might also be originating from here

KingHowler commented 2 months ago

I just took a look, the is not a fault in the code. How do you process the .liquid files?

george-gca commented 2 months ago

What do you mean? Liquid files are processed during jekyll build.

KingHowler commented 2 months ago

What do you mean? Liquid files are processed during jekyll build.

I am asking if the you have written some code to dictate the processing of liquids or is it done automatically by jekyll. If it is done automatically then its an issue we will need to have to forward to the ones maintaining jekyll or liquid language.

KingHowler commented 2 months ago

Basically what I mean is that liquid has a feature where it automatically adds closing tags which it thinks are missing. The creators of Liquid must have accidentally set <source> to have a separate closing tag. In order to fix it we'll have to contact the ones maintaining Liquid.

george-gca commented 2 months ago

Every file that starts with a frontmatter

---

---

is processed by jekyll during build.

KingHowler commented 2 months ago

Every file that starts with a frontmatter

---

---

is processed by jekyll during build.

@george-gca, that's exactly what I meant. Jekyll processes liquid files right? You haven't done anything to modify how the processing takes place. This means that the error is in liquid itself.

KingHowler commented 2 months ago

Right now I am working on adding repos to projects. When I am done I will fix the issue with vector images and then send a pull request.

george-gca commented 2 months ago

You haven't done anything to modify how the processing takes place

No, I haven't.

Actually liquid is a template language that jekyll uses. .liquid files only have this extension for better usage by code editors and prettier. But every file that starts with the front matter is processed by jekyll, no matter what the contents are. I've seem even some templates add the front matter to a javascript file to further change its contents.

KingHowler commented 2 months ago

You haven't done anything to modify how the processing takes place

No, I haven't.

Actually liquid is a template language that jekyll uses. .liquid files only have this extension for better usage by code editors and prettier. But every file that starts with the front matter is processed by jekyll, no matter what the contents are. I've seem even some templates add the front matter to a javascript file to further change its contents.

Yeah I read about all that. I also found at that liquid has this neat feature where it auto-closes missing tags. That's where the issue of the non-existent </source> tag occurs. Liquid must think that <source> has a closing tag even though it doesn't. That's why even if you didn't write </source> you can still find it in the HTML files produced.