diff --git a/src/PathautoGenerator.php b/src/PathautoGenerator.php
index 2c110e8..c12df77 100644
--- a/src/PathautoGenerator.php
+++ b/src/PathautoGenerator.php
@@ -191,6 +191,7 @@ class PathautoGenerator implements PathautoGeneratorInterface {
       'langcode' => $langcode,
       'pathauto' => TRUE,
     ), new BubbleableMetadata());
+    debug($alias, $pattern->getPattern());
 
     // Check if the token replacement has not actually replaced any values. If
     // that is the case, then stop because we should not generate an alias.
diff --git a/src/Plugin/pathauto/AliasType/EntityAliasTypeBase.php b/src/Plugin/pathauto/AliasType/EntityAliasTypeBase.php
index d903930..d513df0 100644
--- a/src/Plugin/pathauto/AliasType/EntityAliasTypeBase.php
+++ b/src/Plugin/pathauto/AliasType/EntityAliasTypeBase.php
@@ -7,6 +7,7 @@ use Drupal\Core\Entity\FieldableEntityInterface;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
+use Drupal\Core\Plugin\Context\Context;
 use Drupal\Core\Plugin\ContextAwarePluginBase;
 use Drupal\pathauto\AliasTypeBatchUpdateInterface;
 use Drupal\pathauto\AliasTypeInterface;
@@ -213,4 +214,15 @@ class EntityAliasTypeBase extends ContextAwarePluginBase implements AliasTypeInt
     return $this->prefix;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function setContextValue($name, $value) {
+    // Overridden to avoid merging existing cacheability metadata, which is not
+    // relevant for alias type plugins.
+    $this->context[$name] = new Context($this->getContextDefinition($name), $value);
+    return $this;
+  }
+
+
 }
