An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# Shortcut plugin for Craft CMS

Simple URL shortening

![Screenshot](resources/icon.png)

## 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)