robwierzbowski / jekyll-image-tag

Better images for Jekyll.
BSD 3-Clause "New" or "Revised" License
98 stars 26 forks source link

Front-matter variable for image_src #1

Closed bostondv closed 11 years ago

bostondv commented 11 years ago

I use a custom image path variable in my front-matter for creating a "featured" image in articles. I would like use the image tag with it.

Is it possible to pass that variable into the image tag such as this?

{% image thumb post.image alt=post.title %}

For me, it interprets post.image literally rather than grabbing the value of that variable.

Thanks!

robwierzbowski commented 11 years ago

This is a little difficult.

With a little refactoring the tag arguments can be re-parsed after they're passed into the plugin (you would write something like {% image {{ post.image }} %}), but that will erase attributes that contain {{ }} or {% %} for handlebars and other JavaScript templating engines. I think using Liquid variables is more important, but I'm not sure if there's a great way to go about this yet.

robwierzbowski commented 11 years ago

Off topic, tried to send you an email about another matter, but it doesn't seem like your contact contact form is working.

bostondv commented 11 years ago

Thanks for the heads up about the contact form, it's been fixed now. Or just send a message to boston [at] pomelodesign.com.

Your fix would work well for my case but totally get it's not great to be breaking other template engines.

Would you be able to point out how I can patch my instance to support your solution?

robwierzbowski commented 11 years ago

This should be working in master now. Give it a test, and let me know if you find any issues.

bostondv commented 11 years ago

Works great!

robwierzbowski commented 11 years ago

Sweet!