diff --git b/core/modules/rdf/rdf.module a/core/modules/rdf/rdf.module index ba3c00e..86aa0a0 100644 --- b/core/modules/rdf/rdf.module +++ a/core/modules/rdf/rdf.module @@ -440,8 +440,8 @@ function rdf_preprocess_comment(&$variables) { // Adds RDFa markup for the relation between the comment and its author. $author_mapping = $mapping->getPreparedFieldMapping('uid'); if (!empty($author_mapping)) { - // Wraps the 'author' and 'submitted' variables which are both available - // in comment.html.twig. + // Wraps the 'author' and 'submitted' variables which are both available in + // comment.html.twig. foreach (['author', 'submitted'] as $variable) { $variables[$variable] = [ '#type' => 'html_tag', @@ -462,11 +462,15 @@ function rdf_preprocess_comment(&$variables) { '#theme' => 'rdf_metadata', '#metadata' => array($date_attributes), ); - $created_metadata_markup = drupal_render($rdf_metadata); // Appends the markup to the created variable and the submitted variable // which are both available in comment.html.twig. - $variables['created'] = SafeMarkup::format('@created@metadata_markup', ['@created' => $variables['created'], '@metadata_markup' => $created_metadata_markup]); - $variables['submitted'] = SafeMarkup::format('@submitted@metadata_markup' , ['@submitted' => $variables['submitted'], '@metadata_markup' => $created_metadata_markup]); + foreach (['created', 'submitted'] as $variable) { + $variables[$variable] = [ + // Ensure the original variable is represented as a render array. + !is_array($variables[$variable]) ? ['#markup' => $variables[$variable]] : $variables[$variable], + $rdf_metadata, + ]; + } } $title_mapping = $mapping->getPreparedFieldMapping('subject'); if (!empty($title_mapping)) {