Shortcut 3.x

Legacy documentation for Shortcut 3.x.

Shortcut Fieldtype

With the Shortcut fieldtype, you can automatically generate shortcuts for channel entries on the fly as you publish or update them. It can be a field you setup and forget about and let Shortcut do its thing, or you specify your own custom shortcut keys. It's up to you. Like all fieldtypes, you can create differently configured Shortcut fields for each channel (through field groups), and have more than one per field group. The following steps will help you get started with creating and using Shortcut fields:

1) Creating a Shortcut Field

Creating a custom channel field as a Shortcut fieldtype is easy:

  • Go to the Channel Manager area in the CP. Click on Field Groups nav item on left, and under the applicable Field Group, select Fields button.
  • At top right, click the Create New button.
  • For the Type option, select Shortcut from the list.
  • Name the field as you wish - for example Short URL with short name of short_url.
  • Continue to fill out the rest of the field as usual, and then scroll down to Field Options area of the page.
  • For the Default Full URL field, specify the base URL structure your entry has or is likely to have. You may use {site_url}, {entry_id}, and {url_title} variables to populate them dynamically in the full URL (ex:{url_title} or {site_url}blog/article/{url_title})
  • Click Save Field button to save the new custom field.
  • If you wish to create more Shortcut fields, just follow the procedure above again.

2) Automatically Generating Shortcuts for Entries

Once you have a Shortcut channel entry field setup, assigning automatically generated shortcuts to entries is very easy!

  • Go to the Publish area in the control panel. If the field group the Shortcut field is assigned to the channel you selected, you should now see the Shortcut field.
  • As long as the field is in the publish page, you don't need to do anything. Shortcut will generate the shortcut URL's automatically.
  • If you wish to alter the default entry path URL, simply adjust the URL path in the Full URL field. And remember, you may use {site_url}, {entry_id}, and {url_title} variables to populate them dynamically in the full URL.
  • If you'd like to have a custom shortcut key for your Shortcut URL, enter a value in the Custom Shortcut field. Remember to specify the Shortcut prefix in this field as well. For example, if you want to have pants as your shortcut key, and your sites' Shortcut Prefix is x, you should enter xpants as the value. If you do not include the necessary prefix, Shortcut will generate a shortcut URL anyway, but use a randomly generated key instead.
  • Once you submit the channel entry, that's it! The entry will now contain a shortcut URL.

click to enlarge click to enlarge

3) Editing Shortcuts for Entries

If you'd like to edit the full URL path, the entry URL title, or even modify or add a custom shortcut key, simply adjust the values in the Shortcut field in the publish page for the corresponding entry.

  • To edit the URL path for the entry, just adjust the value in the Full URL field.
  • To modify or add a custom shortcut key for the entry, adjust value in the Custom Shortcut field
  • If you update the URL title of the entry, and you use the {url_title} variable in your Full URL field, Shortcut will automatically adjust the URL for the shortcut.
  • If you wish to exclude the entry from getting a shortcut, or remove an existing shortcut from the entry, just make sure the Full URL field is blank.

4) Displaying Shortcuts in EE Templates

To display the shortcut URL's for your entries on the front end of your site, simply specify the short name of the Shortcut custom channel field as a variable inside of the Channel:Entries tag. The Shortcut field variable will parse as the shortcut URL generated for that entry.

5) Using with Channel Form

You can use Shortcut fieldtypes with Channel:Form tag as well. Simply call the short name of your Shortcut field, prepended with field: in your template. So for example, if your Shortcut field has a short name of shorty, the variable you would use is {field:shorty}.