Embedding Instagram post in the blog (helper with a partial)

Hey!

I would like to embed an Instagram post within the Markdown article and since the embed code is pretty big and I will be including Instagram posts many times across the site, I think coming up with helper and a layout to store the embed code will be the best idea.

How can I point in a helper that I will be using layout available under source/layouts/_embed-instagram.haml?

For anyone who is looking for something similar, I solved it without additional helpers.

I included in my Markdown file:

<%= partial("layouts/embed-instagram", locals: { url: "URLTOINSTAGRAMPOST", author: "AUTHOR" }) %>

which is passing those locales to the embed code in partial.

Is your file’s extensions chain like something.html.md.erb?

yeah I had to change the file extension and add .erb at the end in order to process it. Couldn’t figure the way yet with my default article.html.markdown files.

As far as I know there is no Markdown parser available in Middleman that allows to insert any Ruby-code snippet, so the trick to add .erb to template-chain is the only way to go. The drawback is if your favorite editor doesn’t allow to colorize/visualize Markdown code when file extention is not .md.

Could you elaborate more? I don’t know what you mean.