From 9ddf606259b7591518b7d72185d80a896e484a58 Mon Sep 17 00:00:00 2001 From: Gene Chi Date: Mon, 22 Jan 2024 10:52:44 -0500 Subject: [PATCH 1/2] [806] - Add canonical url link --- .../usagov_benefit_finder_page.module | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/usagov_benefit_finder/modules/usagov_benefit_finder_app/usagov_benefit_finder_page/usagov_benefit_finder_page.module b/usagov_benefit_finder/modules/usagov_benefit_finder_app/usagov_benefit_finder_page/usagov_benefit_finder_page.module index cc6d53e6a..6927e7e3b 100644 --- a/usagov_benefit_finder/modules/usagov_benefit_finder_app/usagov_benefit_finder_page/usagov_benefit_finder_page.module +++ b/usagov_benefit_finder/modules/usagov_benefit_finder_app/usagov_benefit_finder_page/usagov_benefit_finder_page.module @@ -42,6 +42,13 @@ function usagov_benefit_finder_page_page_attachments_alter(array &$page) { if ($node && $node->bundle() == "bears_life_event") { if (\Drupal::routeMatch()->getRouteName() == 'entity.node.canonical') { $page['#attached']['library'][] = 'usagov_benefit_finder_page/benefit_finder_app'; + $url=$node->toUrl('canonical')->setAbsolute(TRUE); + $page['#attached']['html_head_link'][]=[ + [ + 'rel'=>'canonical', + 'href'=>$url->toString(), + ], + ]; } } } From ccd22d88dcd50b819e0fe619fc6f63768b7e1b7d Mon Sep 17 00:00:00 2001 From: Gene Chi Date: Tue, 23 Jan 2024 10:54:46 -0500 Subject: [PATCH 2/2] [806] - PHP CodeSniff --- .../usagov_benefit_finder_page.module | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usagov_benefit_finder/modules/usagov_benefit_finder_app/usagov_benefit_finder_page/usagov_benefit_finder_page.module b/usagov_benefit_finder/modules/usagov_benefit_finder_app/usagov_benefit_finder_page/usagov_benefit_finder_page.module index 6927e7e3b..add471913 100644 --- a/usagov_benefit_finder/modules/usagov_benefit_finder_app/usagov_benefit_finder_page/usagov_benefit_finder_page.module +++ b/usagov_benefit_finder/modules/usagov_benefit_finder_app/usagov_benefit_finder_page/usagov_benefit_finder_page.module @@ -42,11 +42,11 @@ function usagov_benefit_finder_page_page_attachments_alter(array &$page) { if ($node && $node->bundle() == "bears_life_event") { if (\Drupal::routeMatch()->getRouteName() == 'entity.node.canonical') { $page['#attached']['library'][] = 'usagov_benefit_finder_page/benefit_finder_app'; - $url=$node->toUrl('canonical')->setAbsolute(TRUE); - $page['#attached']['html_head_link'][]=[ + $url = $node->toUrl('canonical')->setAbsolute(TRUE); + $page['#attached']['html_head_link'][] = [ [ - 'rel'=>'canonical', - 'href'=>$url->toString(), + 'rel' => 'canonical', + 'href' => $url->toString(), ], ]; }