Installation #
To install Shortcut, follow these steps:
- Download & unzip the file and place the
shortcut
directory into yourcraft/plugins
directory - Install plugin in the Craft Control Panel under Settings > Plugins
- The plugin folder should be named
shortcut
for Craft to see it.
Shortcut works on Craft 2.4.x and above.
Shortcut Overview #
Let's you create short urls for elements or url's.
Using Shortcut #
To create a short url for a element:
{% set shortcut = craft.shortcut.get({ element: entry }) %}
{{ shortcut.getUrl() }}
To create a short url for a url:
{% set shortcut = craft.shortcut.get({ url: 'https://cnn.com' }) %}
{{ shortcut.getUrl() }}
By default, short urls is in the format xxxx.tld/s/aBC123
. If you want to change the url segment from s
to something custom, you can add a config file called shortcut.php in craft/config to override it:
<?php
return [
// Override Shortcut URL segment
'urlSegment' => 'x',
];
If you want to remove the url segment completely and get urls like xxxx.tld/aBC123
, you can enable the hideUrlSegment
option.
<?php
return [
// Hide url segment
'hideUrlSegment' => true,
];
To use a custom domain, add the domain with the customDomain
option.
<?php
return [
// Set custom domain
'customDomain' => 'https://cool.domain',
];
Releases
- Improved: Added custom domain option
- Improved: Added option to remove Shortcut url segment completely
- Improved: Incease url column length to prevent longer urls being truncated
- Added: Added locale support
- Added: Added config option for custom url segment
- Improved: Update saved url when element is updated
- Improved: Now fetches the url directly from the element instead of using db value
- Added: Initial release
Currently available for Craft consulting and custom plugin development
Contact me