Provides an easy way to define CTAs in your project using a data file and defined structure.
Add the gem to your Gemfile:
gem 'middleman-cta'
Then run bundle.
$> bundle install
In your data/cta.yml
(or JSON):
-
id: great-cta
image: name-of-file-in-cta-image-dir.jpg
url: "http://absolute.url"
If you prefer, you can link using a sitemap descriptor instead - meaning any item defined in your middelman site.
[
{
"id": "great-cta",
"image": "name-of-file-in-cta-image-dir.jpg",
"url": "/my/great/page/index.html"
}
]
You can configure the name of the data file, as well as the directory in which the images are stored.
activate :cta do |cta|
cta.cta_directory = 'cta_images'
cta.cta_data = 'call_to_actions'
end
We support two template engines by default, ERB and Markdown. For Markdown support, we currently only support Redcarpet as the markdown engine.
You have access to a helper method to use in ERB:
<h2>Signup Now</h2>
<%= cta('unique-cta-id') %>
## Signup Now
[cta:unique-cta-id]