Translation alias are not invalidated on Cloudfront

Created on 18 July 2024, 4 months ago

Problem/Motivation

The translated paths are not cleaned

Steps to reproduce

Create multilangauge website and then edit a translation of a node, the node translation path is cache is not invalidated on cloudfront

Proposed resolution

Fix by checking if the entity is a translation or original and get the relative alias

Remaining tasks

implement the code

User interface changes

not needed

API changes

not needed

Data model changes

not needed

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇮🇹Italy bigbabert Milano, Italy

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @bigbabert
  • 🇮🇹Italy bigbabert Milano, Italy
  • 🇺🇸United States joncjordan Colorado Springs, CO

    The second arg of getAliasByPath is langocde. I think we could update this line to account for the language of the entity being saved:

    $detail_page = $config->get('detail_page')[$i] ? \Drupal::service('path_alias.manager')->getAliasByPath("/$bundle/" . $entity_id) : '';
    

    changes to:

    $detail_page = $config->get('detail_page')[$i] ? \Drupal::service('path_alias.manager')->getAliasByPath("/$bundle/" . $entity_id, $entity->language()->id()) : '';
    
  • 🇺🇸United States joncjordan Colorado Springs, CO

    Hmm I take that back... it doesn't seem to be prepending the URL with the language code. Maybe we should just use this method instead:

    $entity->toUrl('canonical')->toString() 
    
Production build 0.71.5 2024