diff -u b/core/modules/tracker/tracker.pages.inc b/core/modules/tracker/tracker.pages.inc --- b/core/modules/tracker/tracker.pages.inc +++ b/core/modules/tracker/tracker.pages.inc @@ -140,11 +140,13 @@ $page['#cache']['tags'] = $cache_tags; $page['#cache']['contexts'][] = 'user.node_grants:view'; - // Cacheable per "authenticated or not", because we can only track (and show) - // reading history for authenticated users, not for anonymous users. - $page['#cache']['contexts'][] = 'user.roles:authenticated'; - if (Drupal::moduleHandler()->moduleExists('history') && \Drupal::currentUser()->isAuthenticated()) { - $page['#attached']['library'][] = 'tracker/history'; + // Display the reading history if that module is enabled. + if (\Drupal::moduleHandler()->moduleExists('history')) { + // Reading history is tracked for authenticated users only. + if (\Drupal::currentUser()->isAuthenticated()) { + $page['#attached']['library'][] = 'tracker/history'; + } + $page['#cache']['contexts'][] = 'user.roles:authenticated'; } return $page;