https://github.com/sjelfull/shortcut
Simple URL shortening
https://github.com/sjelfull/shortcut
craft craft-plugin craftcms craftcms-plugin
Last synced: 4 months ago
JSON representation
Simple URL shortening
- Host: GitHub
- URL: https://github.com/sjelfull/shortcut
- Owner: sjelfull
- License: mit
- Created: 2017-06-01T14:26:02.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-06T18:48:16.000Z (about 8 years ago)
- Last Synced: 2025-03-17T04:43:16.758Z (7 months ago)
- Topics: craft, craft-plugin, craftcms, craftcms-plugin
- Language: PHP
- Size: 74.2 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Shortcut plugin for Craft CMS
Simple URL shortening

## Installation
To install Shortcut, follow these steps:
1. Download & unzip the file and place the `shortcut` directory into your `craft/plugins` directory
4. Install plugin in the Craft Control Panel under Settings > Plugins
5. 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:
```twig
{% set shortcut = craft.shortcut.get({ element: entry }) %}
{{ shortcut.getUrl() }}
```To create a short url for a url:
```twig
{% 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
'x',
];
```If you want to remove the url segment completely and get urls like `xxxx.tld/aBC123`, you can enable the `hideUrlSegment` option.
```php
true,
];
```To use a custom domain, add the domain with the `customDomain` option.
```php
'https://cool.domain',
];
```Brought to you by [Superbig](https://superbig.co)