Problem/Motivation

A view-mode tab only lives under the entity's system path. With /node/1 aliased as /my-pub and a tab with the slug reviews, the tab is at /node/1/reviews: /my-pub/reviews is a 404, every link to the tab shows the system path, and a decoupled frontend that asks Decoupled Router to translate /my-pub/reviews gets nothing back.

Proposed resolution

  • A per-tab option, Resolve under the entity's path alias (alias_subpath, off by default), offered on view-mode tabs only. Form-mode tabs are admin URLs and keep their system path. A post-update stores FALSE on existing tabs.
  • One inbound/outbound path processor that derives the sub-path instead of storing aliases for it:
    • inbound, after core's alias processor: /my-pub/reviews becomes /node/1/reviews when reviews is the slug of an enabled tab and /my-pub is the alias of a canonical path of one of that tab's entity types;
    • outbound, after core's alias processor: the tab route of an aliased entity becomes /my-pub/reviews.

    A real alias such as /news/reviews on another entity still wins, and with no tab using the option the processor returns before any lookup, so sites that never tick the box see no change.

  • Decoupled Router: hook_decoupled_router_info_alter() adds an entity_route_tab key (id, slug, mode type, mode name) when the translated path is a tab, so a frontend renders the view mode instead of the canonical page.
  • A public service with the rule (split the slug off a path, check that a system path accepts it) for sites that resolve aliases through their own lookup.

Remaining tasks

  • Implement, with kernel tests: both directions, alias ordering, an alias change, a language prefix, Decoupled Router.
  • Follow-up: redirect /old-alias/reviews after an alias is renamed (core's auto-redirect only covers /old-alias).

User interface changes

The tab form gets a "View-mode options" section with one checkbox.

API changes

EntityRouteTabInterface::usesAliasSubpath(); the service content_entity_routes.alias_subpath; Decoupled Router responses for tab paths gain entity_route_tab.

Data model changes

A new boolean alias_subpath on entity_route_tab config entities.

Comments

kmajzlik created an issue. See original summary.

  • kmajzlik committed fd00ace6 on 0.x
    #3627577 - Resolve view-mode tabs under the entity's path alias
    
    A view-...
kmajzlik’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • kmajzlik committed a0de82a0 on 0.x
    #3627577 - Fix coding standards in AliasSubpathTest
    
    Co-Authored-By:...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.