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

feat: make srcset actually useful #1170

Merged
merged 16 commits into from
Feb 9, 2024
Merged

Conversation

Sped0n0ld
Copy link
Contributor

@Sped0n0ld Sped0n0ld commented Jan 28, 2024

also fix #1168

will work on documentation after everything is settled.

Copy link

vercel bot commented Jan 28, 2024

Someone is attempting to deploy a commit to a Personal Account owned by @HEIGE-PCloud on Vercel.

@HEIGE-PCloud first needs to authorize it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just revert the changes I made in cacheRemoteImages pr, many other partial will use this hook, would be better to keep it "neutral".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid interfering with the images in the header and other sections, I have created two variables: Optim and Remote. To enable the corresponding functionality, you must explicitly set these variables to true.

The srcset optimization is now enabled in the following parts:

  • markdown image render hook
  • image shortcode
  • summary image in single view
  • summary image in list view.

Copy link

vercel bot commented Jan 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
do-it ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 9, 2024 7:00pm

Comment on lines 30 to 40
# [Experimental] cache remote images in markdown, more info: https://github.com/HEIGE-PCloud/DoIt/pull/860#issue-1574342372
# [试验性功能] 缓存图床图片,详情请见:https://github.com/HEIGE-PCloud/DoIt/pull/860#issue-1574342372
cacheRemoteImages = false
cacheRemoteImages = true
# [Experimental] generate image srcset attribute with hugo image processing feature.
# [试验性功能] 使用 hugo 图片处理功能生成 srcset 属性
optimizeImages = true
# [Experimental] resize method for srcset attribute in optimizeImages, more info: https://gohugo.io/content-management/image-processing/#image-processing-options
# [实验性功能] optimizeImages 中 srcset 属性的缩放方法, 详情请见:https://gohugo.io/content-management/image-processing/#image-processing-options
srcsetSmallResizeMethod = "700x webp Lanczos q75"
srcsetDefaultResizeMethod = "1200x webp Lanczos q75"
srcsetLargeResizeMethod = "2000x webp Lanczos q75"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it be better if we moves these options under [page] so there can be page level control using the front matter?

@HEIGE-PCloud HEIGE-PCloud merged commit 9172ad4 into HEIGE-PCloud:main Feb 9, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

[FEATURE] Don't cache remote image link when cacheRemoteImages is enabled
3 participants