Skip to content

aberkie/craft-shortener

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

Shortener

Craft CMS Plugin for shortening URLs with Bitly

##Bitly Generic Access Token To use this plugin, you will need a bitly generic access token to authenticate your account. You can get your token here!

Hey! Now that you have this fancy token, why don't you check out Verbatim (GitHub) for deep linking content!

##Install

  1. Upload entire shortener directory to craft/plugins on your server.
  2. Navigate to your site's Plugin settings from the Control Panel.
  3. Click Install

##Settings ####Bitly Token

Required. You can get your token here.

####Cache Time In Seconds (Default is 1 day)

Required. Set a high cache time to increase performance. Default is 86400 for one day.

####Domain Choose either bit.ly, j.mp, or bitly.com to use for your shortened URLs.

####Custom Short Domain Optional. Enter your branded short domain that you have registered with bitly. Entering anything in this box will override the Domain setting above.

##Usage Shortener can be used from any template or plugin.

###Template Options You have two options to use shortener from a template, as a Twig filter or as a plugin variable.

####Twig Filter {% set longUrl = 'https://buildwithcraft.com/' %}

Shortened Url: {{ longUrl|shorten }}

####Plugin Variable {% set longUrl = 'https://buildwithcraft.com/' %} {% set shortUrl = craft.shortener.shorten(longUrl) %}

###From a Plugin To call shorten from a different Craft plugin:

$shortUrl = craft()->shortener->shorten($longUrl);

##Changelog

###1.1

  • added custom domain field

###1.0

  • initial release

About

Craft CMS Plugin for shortening URLs with Bitly

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published