From 5bfdf14483c1135f39743f0a242d94e21043e016 Mon Sep 17 00:00:00 2001 From: Erin Dalzell Date: Tue, 15 Oct 2024 17:53:34 -0700 Subject: [PATCH] Remove trailing slash from absolute `home_url` meta (#356) * update tests * pass tests * fix more tests * another one * Diff (our pint.json doesn't enforce this). --------- Co-authored-by: Jesse Leite --- src/Cascade.php | 2 +- tests/CascadeTest.php | 8 ++++---- tests/GraphQLTest.php | 8 ++++---- tests/HumansTest.php | 2 +- tests/Localized/GraphQLTest.php | 2 +- tests/MetaTagTest.php | 8 ++++---- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Cascade.php b/src/Cascade.php index a9e790d4..5e5a6156 100644 --- a/src/Cascade.php +++ b/src/Cascade.php @@ -88,7 +88,7 @@ public function get() 'canonical_url' => $this->canonicalUrl(), 'prev_url' => $this->prevUrl(), 'next_url' => $this->nextUrl(), - 'home_url' => URL::makeAbsolute('/'), + 'home_url' => Str::removeRight(URL::makeAbsolute('/'), '/'), 'humans_txt' => $this->humans(), 'site' => $this->site(), 'alternate_locales' => $alternateLocales = $this->alternateLocales(), diff --git a/tests/CascadeTest.php b/tests/CascadeTest.php index 92dabc5c..86a32112 100644 --- a/tests/CascadeTest.php +++ b/tests/CascadeTest.php @@ -39,7 +39,7 @@ public function it_generates_seo_cascade_from_site_defaults_and_home_entry() 'canonical_url' => 'http://cool-runnings.com', 'prev_url' => null, 'next_url' => null, - 'home_url' => 'http://cool-runnings.com/', + 'home_url' => 'http://cool-runnings.com', 'humans_txt' => 'http://cool-runnings.com/humans.txt', 'site' => Site::get('default'), 'alternate_locales' => [], @@ -77,7 +77,7 @@ public function it_overwrites_data_in_cascade() 'canonical_url' => 'http://cool-runnings.com', 'prev_url' => null, 'next_url' => null, - 'home_url' => 'http://cool-runnings.com/', + 'home_url' => 'http://cool-runnings.com', 'humans_txt' => 'http://cool-runnings.com/humans.txt', 'site' => Site::get('default'), 'alternate_locales' => [], @@ -166,7 +166,7 @@ public function it_generates_seo_cascade_without_exception_when_no_home_entry_ex 'canonical_url' => 'http://cool-runnings.com', 'prev_url' => null, 'next_url' => null, - 'home_url' => 'http://cool-runnings.com/', + 'home_url' => 'http://cool-runnings.com', 'humans_txt' => 'http://cool-runnings.com/humans.txt', 'site' => Site::get('default'), 'alternate_locales' => [], @@ -225,7 +225,7 @@ public function it_generates_seo_cascade_from_custom_site_defaults_path() 'canonical_url' => 'http://cool-runnings.com', 'prev_url' => null, 'next_url' => null, - 'home_url' => 'http://cool-runnings.com/', + 'home_url' => 'http://cool-runnings.com', 'humans_txt' => 'http://cool-runnings.com/humans.txt', 'site' => Site::get('default'), 'alternate_locales' => [], diff --git a/tests/GraphQLTest.php b/tests/GraphQLTest.php index f61b93cc..127e69a4 100644 --- a/tests/GraphQLTest.php +++ b/tests/GraphQLTest.php @@ -68,7 +68,7 @@ public function it_queries_for_entry_seo_meta_html() '', '', '', - '', + '', '', '', ])->implode(''); @@ -145,7 +145,7 @@ public function it_queries_for_entry_seo_cascade_so_user_can_render_custom_meta( 'alternate_locales' => [], 'prev_url' => null, 'next_url' => null, - 'home_url' => 'http://cool-runnings.com/', + 'home_url' => 'http://cool-runnings.com', 'humans_txt' => 'http://cool-runnings.com/humans.txt', 'twitter_card' => 'summary_large_image', 'twitter_handle' => null, @@ -182,7 +182,7 @@ public function it_queries_for_term_seo_meta_html() '', '', '', - '', + '', '', '', ])->implode(''); @@ -259,7 +259,7 @@ public function it_queries_for_term_seo_cascade_so_user_can_render_custom_meta() 'alternate_locales' => [], 'prev_url' => null, 'next_url' => null, - 'home_url' => 'http://cool-runnings.com/', + 'home_url' => 'http://cool-runnings.com', 'humans_txt' => 'http://cool-runnings.com/humans.txt', 'twitter_card' => 'summary_large_image', 'twitter_handle' => null, diff --git a/tests/HumansTest.php b/tests/HumansTest.php index 57d32fc0..22102df9 100644 --- a/tests/HumansTest.php +++ b/tests/HumansTest.php @@ -30,7 +30,7 @@ public function it_outputs_humans_txt() /* TEAM */ Creator: Site Name -URL: http://cool-runnings.com/ +URL: http://cool-runnings.com Description: I see a bad-ass mother. /* THANKS */ diff --git a/tests/Localized/GraphQLTest.php b/tests/Localized/GraphQLTest.php index 8317d18c..0a2de8e7 100644 --- a/tests/Localized/GraphQLTest.php +++ b/tests/Localized/GraphQLTest.php @@ -44,7 +44,7 @@ public function it_queries_multisite_for_canonical_url_and_alternate_locales_in_ '', '', '', - '', + '', '', '', '', diff --git a/tests/MetaTagTest.php b/tests/MetaTagTest.php index 46610d7b..30828a1a 100644 --- a/tests/MetaTagTest.php +++ b/tests/MetaTagTest.php @@ -71,7 +71,7 @@ public function it_generates_normalized_meta($viewType) - + EOT; @@ -103,7 +103,7 @@ public function it_generates_normalized_meta_when_visiting_statamic_route_with_r - + EOT; @@ -383,7 +383,7 @@ public function it_generates_home_url_for_entry_meta($viewType) $response = $this->get('/about'); $response->assertSee("

{$viewType}

", false); - $response->assertSee('', false); + $response->assertSee('', false); } /** @@ -744,7 +744,7 @@ public function it_generates_normalized_meta_from_custom_site_defaults_path($vie - + EOT;