diff -u b/core/modules/node/node.module b/core/modules/node/node.module --- b/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -605,22 +605,25 @@ $variables['node'] = $variables['elements']['#node']; /** @var \Drupal\node\NodeInterface $node */ $node = $variables['node']; - $variables['date'] = \Drupal::service('renderer') - ->render($variables['elements']['created']); - unset($variables['elements']['created']); - $variables['author_name'] = \Drupal::service('renderer') - ->render($variables['elements']['uid']); - unset($variables['elements']['uid']); + + // For the fields 'date', 'author_name' and 'title', if there are configured + // display settings then handle as a normal field. If not, then pull the + // information out into separate variables. + if (!$node->created->getFieldDefinition()->isDisplayConfigurable('view')) { + $variables['date'] = \Drupal::service('renderer')->render($variables['elements']['created']); + unset($variables['elements']['created']); + } + if (!$node->uid->getFieldDefinition()->isDisplayConfigurable('view')) { + $variables['author_name'] = \Drupal::service('renderer')->render($variables['elements']['uid']); + unset($variables['elements']['uid']); + } $variables['url'] = $node->url('canonical', [ 'language' => $node->language(), ]); - // If the title's display is not configurable, take control of rendering it. - $variables['label'] = isset($variables['elements']['title']) ? $variables['elements']['title'] : $variables['node']->getTitle(); - $variables['title_configurable'] = TRUE; - if (!$variables['node']->title->getFieldDefinition()->isDisplayConfigurable('view')) { - $variables['title_configurable'] = FALSE; + if (!$node->title->getFieldDefinition()->isDisplayConfigurable('view')) { + $variables['label'] = $variables['elements']['title']; unset($variables['elements']['title']); } diff -u b/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig --- b/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -15,7 +15,7 @@ * Calling other methods, such as node.delete(), will result in an exception. * See \Drupal\node\Entity\Node for a full list of public properties and * methods for the node object. - * - label: The title of the node. + * - label: The title of the node (blank if data should not be shown). * - content: All node items. Use {{ content }} to print them all, * or print a subset such as {{ content.field_example }}. Use * {{ content|without('field_example') }} to temporarily suppress the printing @@ -23,8 +23,8 @@ * - author_picture: The node author user entity, rendered using the "compact" * view mode. * - metadata: Metadata for this node. - * - date: Themed creation date field. - * - author_name: Themed author name field. + * - date: Themed creation date field (blank if data should not be shown). + * - author_name: Themed author name field (blank if data should not be shown). * - url: Direct URL of the current node. * - display_submitted: Whether submission information should be displayed. * - attributes: HTML attributes for the containing element. @@ -62,8 +62,6 @@ * current user is a logged-in member. * - is_admin: Flag for admin user status. Will be true when the current user * is an administrator. - * - title_configurable: Flag for title field configurability. Will be true when - * the title field is configurable in view modes. * * @see template_preprocess_node() * @@ -77,14 +75,14 @@ {{ title_prefix }} - {% if not page and (title_configurable is not defined or not title_configurable) %} + {% if not page and label) %} {{ label }} {% endif %} {{ title_suffix }} - {% if display_submitted %} + {% if display_submitted and author_name and date %}