Skip to content

Allows you to easily define a CTA (Call to Action) in markdown or ERB.

Notifications You must be signed in to change notification settings

madebylotus/middleman-cta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

middleman-cta

Provides an easy way to define CTAs in your project using a data file and defined structure.

Installation

Add the gem to your Gemfile:

gem 'middleman-cta'

Then run bundle.

$> bundle install

Usage

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"
  }
]

Configuration

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

Rendering

We support two template engines by default, ERB and Markdown. For Markdown support, we currently only support Redcarpet as the markdown engine.

ERB

You have access to a helper method to use in ERB:

<h2>Signup Now</h2>
<%= cta('unique-cta-id') %>

Markdown

## Signup Now
[cta:unique-cta-id]

About

Allows you to easily define a CTA (Call to Action) in markdown or ERB.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages