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

Support images defined in Front Matter #10

Open
mavaddat opened this issue Oct 27, 2021 · 2 comments
Open

Support images defined in Front Matter #10

mavaddat opened this issue Oct 27, 2021 · 2 comments

Comments

@mavaddat
Copy link
Owner

From jekyll-cloudinary created by nhoizey: nhoizey#88

From a comment by @judsonlmoore in #51 :
nhoizey#51 (comment)

@mavaddat
Copy link
Owner Author

Hi @judsonlmoore ,

I'm very sorry for the late answer. I don't use Jekyll anymore and have little time for my numerous pet projects like this one.

I think I have a similar issue as what is described here, so will add a comment instead of starting a new topic.

I think your issue is not related to @k16e-me 's.

He's trying to use the Liquid tag in a page, but it unfortunately works only in posts.

I've been trying to use this (awesome!) plugin to transform images in the page templates with Cloudinary. I've tried a wide array of implementation options including the below:

{% cloudinary page.image alt="{{ page.title }}" %}
{% cloudinary { page.image } alt="{{ page.title }}" %}
{% cloudinary {{ page.image }} alt="{{ page.title }}" %}

It looks like you try to use the Liquid tag with an image that you define in Front Matter, which is not supported either. But is a different feature.

Interestingly, the page.title attribute is supported and does properly print the page title into the alt tag.

I guess this is because Jekyll processes site variables (such as {{ page.* }}) before Liquid tags:
https://jekyllrb.com/tutorials/orderofinterpretation/#order-of-interpretations

However, the tag for the page.image without brackets simply inserts that text at the end of the cloudinary url with this error:

I guess then {% cloudinary {{ page.image }} … should work too, I'll have to investigate why it doesn't.

[Cloudinary] Couldn't find this image to check its width: /Users/judmoore/github/judsonlmoore.com/_posts/travel/destinations/ireland/page.imag.
Note that the "e" is missing at the end of page.image. Not sure why.

This might help me track the issue, thanks for noticing.

Questions

1. Is there a currently-supported proper way to do what I am aiming to accomplish?

I'm not sure, I'll try to fix this and document an official way.

2. Might this be supported soon?

Soon, I'm not sure, as I have to install the whole Ruby/Jekyll stuff again on a computer.

I'll do my best.

3. Any other recommendations for handling non-post-content images with cloudinary?

Did you try using absolute URLs for the image?

`{% cloudinary https://example.com/path/to/the/image.jpg alt="…" %}

@mavaddat
Copy link
Owner Author

By the way, it looks like @carloteran19 is using Front Matter defined images without (this) issue:
nhoizey#87 (comment)

Might be worth discussing…

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

No branches or pull requests

1 participant