geerlingguy / jeffgeerling-com

Drupal Codebase for JeffGeerling.com
https://www.jeffgeerling.com
GNU General Public License v2.0
39 stars 2 forks source link

Home page title is not working correctly #68

Closed geerlingguy closed 4 years ago

geerlingguy commented 4 years ago

I thought I had fixed this... but the head title is 'Home | Jeff Geerling'. It should be 'Jeff Geerling - Author and Software Developer in St. Louis, MO'

See: https://github.com/geerlingguy/jeffgeerling-com/blob/master/web/themes/jeffgeerling/jeffgeerling.theme#L23

geerlingguy commented 4 years ago

Fixed this by changing from a check for $variables['is_front']; (which didn't seem to work) to:

/**
 * Implements template_preprocess_html().
 */
function jeffgeerling_preprocess_html(&$variables) {
  $path_matcher = \Drupal::service('path.matcher');

  // Override the page title on the front page.
  if ($path_matcher->isFrontPage()) {
    // Code...
  }
}