diff --git a/core/lib/Drupal/Core/Controller/HtmlPageController.php b/core/lib/Drupal/Core/Controller/HtmlPageController.php
index d87b3ed..f5649dc 100644
--- a/core/lib/Drupal/Core/Controller/HtmlPageController.php
+++ b/core/lib/Drupal/Core/Controller/HtmlPageController.php
@@ -66,8 +66,18 @@ public function content(Request $request, $_content) {
       );
     }
     // If no title was returned fall back to one defined in the route.
-    if (!isset($page_content['#title']) && $request->attributes->has('_title')) {
-      $page_content['#title'] = $request->attributes->get('_title');
+    if (!isset($page_content['#title'])) {
+      // A dynamic title takes priority.
+      if ($request->attributes->has('_title_callback')) {
+        $callback = $request->attributes->get('_title_callback');
+        $callable = $this->controllerResolver->getControllerFromDefinition($callback);
+        $arguments = $this->controllerResolver->getArguments($request, $callable);
+        $page_content['#title'] = call_user_func_array($callable, $arguments);
+      }
+      elseif ($request->attributes->has('_title')) {
+        // Fall back to a static string from the route.
+        $page_content['#title'] = $request->attributes->get('_title');
+      }
     }
 
     $response = new Response(drupal_render_page($page_content));
