diff --git a/core/themes/bartik/bartik.theme b/core/themes/bartik/bartik.theme
index ab4683c239f74ba02bbc5a30af9bf04b508ca672..59133a5a17e580a53f915a6d9eb6b5fca94af738 100644
--- a/core/themes/bartik/bartik.theme
+++ b/core/themes/bartik/bartik.theme
@@ -63,19 +63,9 @@ function bartik_preprocess_page(&$variables) {
     $variables['secondary_menu']['#attributes']['class'] = array('links', 'inline', 'clearfix');
   }
 
-  $site_config = \Drupal::config('system.site');
-  // Always print the site name and slogan, but if they are toggled off, we'll
-  // just hide them visually.
-  $variables['hide_site_name']   = theme_get_setting('features.name') ? FALSE : TRUE;
-  $variables['hide_site_slogan'] = theme_get_setting('features.slogan') ? FALSE : TRUE;
-  if ($variables['hide_site_name']) {
-    // If toggle_name is FALSE, the site_name will be empty, so we rebuild it.
-    $variables['site_name'] = check_plain($site_config->get('name'));
-  }
-  if ($variables['hide_site_slogan']) {
-    // If toggle_site_slogan is FALSE, the site_slogan will be empty, so we rebuild it.
-    $variables['site_slogan'] = filter_xss_admin($site_config->get('slogan'));
-  }
+  // Set the options that apply to both page and maintenance page.
+  _bartik_process_page($variables);
+
   // Since the title and the shortcut link are both block level elements,
   // positioning them next to each other is much simpler with a wrapper div.
   if (!empty($variables['title_suffix']['add_or_remove_shortcut']) && $variables['title']) {
@@ -115,21 +105,8 @@ function bartik_preprocess_maintenance_page(&$variables) {
     ),
   );
 
-  drupal_render($libraries);
-
-  $site_config = \Drupal::config('system.site');
-  // Always print the site name and slogan, but if they are toggled off, we'll
-  // just hide them visually.
-  $variables['hide_site_name']   = theme_get_setting('features.name') ? FALSE : TRUE;
-  $variables['hide_site_slogan'] = theme_get_setting('features.slogan') ? FALSE : TRUE;
-  if ($variables['hide_site_name']) {
-    // If toggle_name is FALSE, the site_name will be empty, so we rebuild it.
-    $variables['site_name'] = check_plain($site_config->get('name'));
-  }
-  if ($variables['hide_site_slogan']) {
-    // If toggle_site_slogan is FALSE, the site_slogan will be empty, so we rebuild it.
-    $variables['site_slogan'] = filter_xss_admin($site_config->get('slogan'));
-  }
+  // Set the options that apply to both page and maintenance page.
+  _bartik_process_page($variables);
 }
 
 /**
@@ -197,3 +174,22 @@ function bartik_field__taxonomy_term_reference($variables) {
 
   return $output;
 }
+
+/**
++ * Helper function for handling the site name and slogan.
++ */
+function _bartik_process_page(&$variables) {
+  $site_config = \Drupal::config('system.site');
+  // Always print the site name and slogan, but if they are toggled off, we'll
+  // just hide them visually.
+  $variables['hide_site_name']   = theme_get_setting('features.name') ? FALSE : TRUE;
+  $variables['hide_site_slogan'] = theme_get_setting('features.slogan') ? FALSE : TRUE;
+  if ($variables['hide_site_name']) {
+    // If toggle_name is FALSE, the site_name will be empty, so we rebuild it.
+    $variables['site_name'] = check_plain($site_config->get('name'));
+  }
+  if ($variables['hide_site_slogan']) {
+    // If toggle_site_slogan is FALSE, the site_slogan will be empty, so we rebuild it.
+    $variables['site_slogan'] = filter_xss_admin($site_config->get('slogan'));
+  }
+}