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

append_ext: true doesn't work #14

Open
parth-verma opened this issue Nov 18, 2020 · 2 comments
Open

append_ext: true doesn't work #14

parth-verma opened this issue Nov 18, 2020 · 2 comments

Comments

@parth-verma
Copy link

With append_ext: true, it is expected that images will be generated in the format image.png.webp. However, that is not the case

@GregJacobs82
Copy link

GregJacobs82 commented Nov 19, 2020

Agreed, this does not work for me either. It is outputting a image.webp, but not naming it correctly like it should image.png.webp

As a workaround, in my _includes/picture.html file, for the image source, I used filter | replace: '.png','.webp' " like this:

    <source srcset="{{ include.src | prepend: site.url | replace:'.png','.webp' | replace:'.jpg','.webp' }}" type="image/webp">

Full Example of my _includes/picture.html

<picture>
    <source srcset="{{ include.src | prepend: site.url | replace:'.png','.webp' | replace:'.jpg','.webp' }}" type="image/webp">
    <source srcset="{{ include.src | prepend: site.url }}" type="image/jpeg">
    <img
        src="{{ include.src | prepend: site.url }}"
        {% if include.alt %}alt="{{ include.alt }}"{% endif %}
        {% if include.title %}title="{{ include.title }}"{% endif %}
        {% if include.class %}class="{{ include.class }}"{% endif %}
        {% if include.height %}height="{{ include.height }}"{% endif %}
        {% if include.width %}width="{{ include.width }}"{% endif %}
        {% if include.style %}style="{{ include.style }}"{% endif %}
    >
</picture>

Example to use this include file:

{% include picture.html src="/assets/img/image.png" alt="My alt text!" %}

@felixd
Copy link

felixd commented Feb 9, 2023

Agreed, this does not work for me either. It is outputting a image.webp, but not naming it correctly like it should image.png.webp

As a workaround, in my _includes/picture.html file, for the image source, I used filter | replace: '.png','.webp' " like this:

    <source srcset="{{ include.src | prepend: site.url | replace:'.png','.webp' | replace:'.jpg','.webp' }}" type="image/webp">

Full Example of my _includes/picture.html

<picture>
    <source srcset="{{ include.src | prepend: site.url | replace:'.png','.webp' | replace:'.jpg','.webp' }}" type="image/webp">
    <source srcset="{{ include.src | prepend: site.url }}" type="image/jpeg">
    <img
        src="{{ include.src | prepend: site.url }}"
        {% if include.alt %}alt="{{ include.alt }}"{% endif %}
        {% if include.title %}title="{{ include.title }}"{% endif %}
        {% if include.class %}class="{{ include.class }}"{% endif %}
        {% if include.height %}height="{{ include.height }}"{% endif %}
        {% if include.width %}width="{{ include.width }}"{% endif %}
        {% if include.style %}style="{{ include.style }}"{% endif %}
    >
</picture>

Example to use this include file:

{% include picture.html src="/assets/img/image.png" alt="My alt text!" %}

Neat workaround, going to use it on our webpage :)

FlameIT - Immersion Cooling

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

No branches or pull requests

3 participants