feat: add optional response images with cloudinary #80
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was trying to adapt this to this theme and didn't see another option already available, so I thought you might like this PR. Let me know if this isn't the type of change you want to include in the theme.
This optionally provides a capability for responsive images via Cloudinary. It requires images to be hosted in Cloudinary (I have a free account for my blog). It does not add any weight if someone does not wish to use the feature. If they would like to use this, uncommenting
cloudinary_cloud_name
will load in the necessary javascript.I am using it like this on my markdown articles:
Notably, the
src
path is the remote path in Cloudinary where my image is located, not a local path. This cloudinary configuration will also auto-select the best image type for the user's browser - e.g. AVIF or webp if supported, else png, jpg, etc. So a file extension is excluded from the path in my example.The new
meta
tag addition tohead.html
is to gather mobile device dimensions so images can be properly sized in those cases.