Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293522

Make it possible to link to an entity by UUID

$
0
0

Problem/Motivation

It would be great to provide URLs with UUIDs in their so you can link to them.

The solution would need to meet the following requirements:

  • Allow a UUID-based URL to be used in menus, end-user-facing links should use a path alias when available
  • Allow a UUID-based URL to be used for front page, 403 and 404 pages, without strange redirection by-effects
  • Allow a UUID-based URL to be used as in the page condition for e.g. block-placement. It should not make a difference if the alias-, numeric ID- or UUID-based URL is used, the block should be shown regardless of the URL used to access the content
  • The "duplicate content" situation is not made worse then it is, i.e. search engines should be guided to a canonical URL somehow, either by redirects (for aliases and traditional numeric URLs this is handled by Redirect module in contrib) or a canonical metatag

Proposed resolution

The most recent solution uses a path converter. It relies on the existing behaviour of setting the canonical meta tag to avoid duplicate content issues in terms of SEO (because that is already the approach taken with aliases vs. system paths). Internally, the path is converted to the numeric path, so that anything relying on that also works for the UUID-based URL.

Add a new uuid link template for entities:

$node->toUrl('uuid');

Remaining tasks

  • Adapt path processor to base its work on the canonical URL pattern for all entities, instead of hard coding {entity_type}/{uuid}
  • Add special case code to Entity::toUrl() to handle 'uuid' (or divert to follow-up?)
  • Test all use cases
  • Update CR

User interface changes

The UUID-based URL is available.

API changes

It is possible to request the UUID-based URL for an entity.


Viewing all articles
Browse latest Browse all 293522

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>