Install
Works with Drupal: ^10.3 || ^11Using Composer to manage Drupal site dependencies
Alternative installation files
Release notes
Third beta of Short URL 2.0. It fixes short URLs that showed a page instead of redirecting when a path alias had their slug, which every short URL did under a Pathauto pattern like /[node:title]. It also stops Short URL from building its services when content of other types is saved, viewed or listed.
Upgrade
- Run
drush updatedb: two post-updates run. The first shows the short URL and its QR code with the slug field's new formatter (#3602999). The second deletes the path aliases that short URLs have at their own slug, and lists each one in its output and in the site log (#3603000). - Sites that deploy configuration: export the configuration after
drush updatedb. Otherwise the next configuration import restores the short URL display with the removed "Short URL & QR code" pseudo-field (#3602999). - Themes: a node template that prints
content.shorturl_qrcodemust printcontent.field_shorturl_sluginstead (#3602999).
Behavior changes
A path alias never takes a short URL's slug any more. The Redirect module resolves path aliases before it looks a request up, so an alias at /promo showed its page, and the short URL with the slug promo never redirected (#3603000):
- Short URL nodes get no Pathauto alias: each save turns off their "Generate automatic URL alias" setting. A short URL's address is its slug.
- Pathauto gives other content another alias,
/promo-0for example, instead of a short URL's slug. - The URL alias box of content forms and the URL aliases page refuse a short URL's slug. An alias that is already stored is kept on later saves of its page.
- A slug cannot be changed to a path that already has an alias, the short URL's own node included.
- The update keeps an alias that another page already has at a short URL's slug, because it is that page's address. Change the slug, or that page's alias, to make the short URL redirect again.
- Existing short URL nodes keep the Pathauto setting they had until they are next saved. A bulk "Generate URL aliases" run before then gives them an alias like
/promo-0, never their slug.
The short URL and its QR code are shown by the slug field's "Short URL and QR code" formatter, instead of the "Short URL & QR code" pseudo-field (#3602999).
Bug fixes
- Editing a short URL to the slug of a redirect made before Short URL was installed, or regenerating its slug when its mode changed, failed with a database error. Such redirects now count as taken (#3603000). Domain Short URL has the same fix in 1.x-dev (#3589284).
Performance
- Saving, viewing or listing content of any other type no longer builds Short URL's slug generator, redirect manager, visit tracker and QR code generator (#3602999).
API changes
ShortUrlViewHooksis removed, with theshorturl_qrcodepseudo-field and itshook_node_view(). The field formattershorturl_qrcode(ShortUrlQrCodeFormatter) replaces them.ShortUrlEntityHooksreceives the slug generator, the short URL manager and the visit tracker as closures. Its redirect, operation, field and cron hooks moved toShortUrlRedirectHooks,ShortUrlOperationHooks,ShortUrlFieldHooksandShortUrlCronHooks.- New: the
ShortUrlAliasconstraint on the path aliasaliasfield, andShortUrlRedirectLookupTrait::isShortUrlSlug().