Help building helpers

I’m likely overthinking things here but what I would like to be able to do is create some simple helpers that would take an argument and then output custom HTML code into a blog article. I’ve read up on the helpers in the documentation but I’m just not sure where to begin. Any help would be appreciated.
Adam

Example of what I’d like to be able to do -
<% insert_download(“link/to/file_for_download.zip”) %>

which on build would output the HTML that I create in the help to be reused as I post items with downloads in articles.

Got it all working this can be closed.

For those interested -
In config.rb
helpers do

def image_download(img_path)
if img_path

end
end

end

In article -
<%= image_download(“image.jpg”) %>

Also article needs to have .erb in naming convention so it’s processed otherwise you end up with the plain text of <%= image_download(“image.jpg”) %>

Thanks all

instead of using helpers you can use partials and still pass arguments to it, you can check it there
http://middlemanapp.com/basics/templates/#sts=Partials

if you still wanna use helpers, you can add them to your config.rb you gonna find it commented

# Methods defined in the helpers block are available in templates
# helpers do
#   def some_helper
#     "Helping"
#   end
# end

or create directory on the root of your middleman project and call it “helpers”, then create a file inside of that directory and call “CustomHelpers.rb” and just copy and paste this

module CustomHelpers
   # add your custom def below
    def hello(name)
       #code goes here
       <p>hello #{name}!</p>
    end
end

this how you call the helper in your code

<%= hello(karim) %>

you need to restart middleman when playing with helpers as far as I know

good luck

Can you include a partial in an Article of the blogging extension?

I’m not sure I’ve never used the blogging extension.

A blog article is just like any other Middleman page, so yeah, you can give it an .erb extension and put whatever code you want in it.