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

[BUG] featured images path was not rendered properly on windows browsers #117

Closed
wey-gu opened this issue Jun 24, 2021 · 5 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@wey-gu
Copy link
Contributor

wey-gu commented Jun 24, 2021

Describe the bug 描述你遇到的错误

It's found on windows (firefox, edge) that the featured images on the home page suffered from 404.
It worked well on macOS for all browsers, thus this issue seemed to exist for a long time.
Am I doing it wrong? or something wrong in lazy load part or?

Expected behavior 期待的行为

Browser should display this picture from alt rather than data-src, while it seemed to go for data-src only and 404 encouterred :(

<a href="/nebula-operator-kind/" aria-label=Nebula&#32;Operator&#32;Kind,一键单机玩转&#32;Nebula&#32;K8s&#32;集群><img
        class="lazyload"
        data-src="featured-image.webp"
        data-srcset="/nebula-operator-kind/featured-image.webp, featured-image.webp 1.5x, /nebula-operator-kind/featured-image.webp 2x"
        data-sizes="auto"
        alt="/nebula-operator-kind/featured-image.webp"
        title="无需依赖,一键安装尝鲜基于 Nebula Operator 的 K8s Nebula Graph Cluster" height="auto" width="auto"
    />

I am not expert in the frontend, not sure if the wrong behavior I found is the root cause :-p

Screenshots 屏幕截图

image

Build Environment 构建环境

  • OS: [macOS]
  • Theme version/commit: b4855ef
  • Hugo version: "v0.83.1+extended darwin/arm64 BuildDate=unknown"

Preview Environment 预览环境

  • OS: [Windows 10]
  • Browser [Edge, Firefox]

Additional Information 补充信息

Can be checked from siwei.io in a windows machine.

post head in index.md

---
...
featuredImage: "featured-image.webp"
featuredImagePreview: "featured-image.webp"
---
@wey-gu wey-gu added the bug Something isn't working label Jun 24, 2021
@wey-gu
Copy link
Contributor Author

wey-gu commented Jun 24, 2021

update: tried manually changed lazysizes js to 5.3.1, issue still observed :-)

@HEIGE-PCloud
Copy link
Owner

Try using this way to import featured image for now.

resources:
- name: "featured-image"
  src: "featured-image.webp"
- name: "featured-image-preview"
  src: "featured-image-preview.webp"

I will look into it.

@wey-gu
Copy link
Contributor Author

wey-gu commented Jun 24, 2021

Try using this way to import featured image for now.

resources:
- name: "featured-image"
  src: "featured-image.webp"
- name: "featured-image-preview"
  src: "featured-image-preview.webp"

I will look into it.

Thank you @HEIGE-PCloud !
I switched to the resources now, it should be fine now!

-        data-src="featured-image.webp"
-        data-srcset="/en/nebula-chia/featured-image.webp, featured-image.webp 1.5x, /en/nebula-chia/featured-image.webp 2x"
+        data-src="/en/nebula-chia/featured-image.webp"
+        data-srcset="/en/nebula-chia/featured-image.webp, /en/nebula-chia/featured-image.webp 1.5x, /en/nebula-chia/featured-image.webp 2x"

@HEIGE-PCloud
Copy link
Owner

HEIGE-PCloud commented Jun 24, 2021

The issue is fixed. featuredImage and featuredImagePreview should work correctly.

Now all featured images on the documentation site are set by the newly fixed featuredImage parameters instead of the old resources parameters.

@HEIGE-PCloud HEIGE-PCloud self-assigned this Jun 24, 2021
@HEIGE-PCloud HEIGE-PCloud added this to the v0.2.12 milestone Jun 24, 2021
@wey-gu
Copy link
Contributor Author

wey-gu commented Jun 25, 2021

The issue is fixed. featuredImage and featuredImagePreview should work correctly.

Now all featured images on the documentation site are set by the newly fixed featuredImage parameters instead of the old resources parameters.

Thanks a ton, @HEIGE-PCloud !!! You are turely amazing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants