1. Handlebars Helpers
  2. Stubby Short URL

Handlebars Helpers

Stubby Short URL

Returns a Short URL for any given URL.

Stub.by is a URL shortening service that allows you to create short links for any given URL. This helper will return a HTML Short Link for any given URL.

INFO

IMPORTANT:
Stub.by links are valid for a default of 30 days, you need to set the TTL to 0 to make the permanent

See also: Stubby Short Link

Usage

Helper name : stubby_short_url

The helper supports passing the URL as an argument:

{{#stubby_short_url [URL]}}{{/stubby_short_url}}

It also supports putting the URL within the helper tags:

{{#stubby_short_url [TTL in seconds] [Max Hits]}}[URL]{{/stubby_short_url}}

Example definition:

loading...

Substituted definition

loading...

Advanced usage

You can optionally add these extra arguments

  • TTL: (Time To Live) the amount of seconds that the shortcode should exist for. Default is 30 days.
  • Max Hits: The maximum hits allowed for the shortcode before it expires.

Example definition:

loading...

Substituted definition

loading...

The above shortcode example will remain active for 10 minutes or until it has been accessed 5 times, which ever condition is met first will expire the shortcode.

Within Tag Usage

You can also put the URL inside the helper tags and pass the TTL and Max Hits as arguments.

Example definition:

loading...

Substituted definition

loading...

The above shortcode example shortens the URL inside the helper tags and expires after 10 minutes or 5 hits, whichever condition is met first.