Skip to content

Commit 5bfdf14

Browse files
edalzelljesseleite
andauthored
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 <jesseleite@gmail.com>
1 parent fd6eb1e commit 5bfdf14

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

src/Cascade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function get()
8888
'canonical_url' => $this->canonicalUrl(),
8989
'prev_url' => $this->prevUrl(),
9090
'next_url' => $this->nextUrl(),
91-
'home_url' => URL::makeAbsolute('/'),
91+
'home_url' => Str::removeRight(URL::makeAbsolute('/'), '/'),
9292
'humans_txt' => $this->humans(),
9393
'site' => $this->site(),
9494
'alternate_locales' => $alternateLocales = $this->alternateLocales(),

tests/CascadeTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function it_generates_seo_cascade_from_site_defaults_and_home_entry()
3939
'canonical_url' => 'http://cool-runnings.com',
4040
'prev_url' => null,
4141
'next_url' => null,
42-
'home_url' => 'http://cool-runnings.com/',
42+
'home_url' => 'http://cool-runnings.com',
4343
'humans_txt' => 'http://cool-runnings.com/humans.txt',
4444
'site' => Site::get('default'),
4545
'alternate_locales' => [],
@@ -77,7 +77,7 @@ public function it_overwrites_data_in_cascade()
7777
'canonical_url' => 'http://cool-runnings.com',
7878
'prev_url' => null,
7979
'next_url' => null,
80-
'home_url' => 'http://cool-runnings.com/',
80+
'home_url' => 'http://cool-runnings.com',
8181
'humans_txt' => 'http://cool-runnings.com/humans.txt',
8282
'site' => Site::get('default'),
8383
'alternate_locales' => [],
@@ -166,7 +166,7 @@ public function it_generates_seo_cascade_without_exception_when_no_home_entry_ex
166166
'canonical_url' => 'http://cool-runnings.com',
167167
'prev_url' => null,
168168
'next_url' => null,
169-
'home_url' => 'http://cool-runnings.com/',
169+
'home_url' => 'http://cool-runnings.com',
170170
'humans_txt' => 'http://cool-runnings.com/humans.txt',
171171
'site' => Site::get('default'),
172172
'alternate_locales' => [],
@@ -225,7 +225,7 @@ public function it_generates_seo_cascade_from_custom_site_defaults_path()
225225
'canonical_url' => 'http://cool-runnings.com',
226226
'prev_url' => null,
227227
'next_url' => null,
228-
'home_url' => 'http://cool-runnings.com/',
228+
'home_url' => 'http://cool-runnings.com',
229229
'humans_txt' => 'http://cool-runnings.com/humans.txt',
230230
'site' => Site::get('default'),
231231
'alternate_locales' => [],

tests/GraphQLTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function it_queries_for_entry_seo_meta_html()
6868
'<meta property="og:image:alt" content="" />',
6969
'<meta name="twitter:image" content="http://cool-runnings.com/assets/img/stetson.jpg" />',
7070
'<meta name="twitter:image:alt" content="" />',
71-
'<link href="http://cool-runnings.com/" rel="home" />',
71+
'<link href="http://cool-runnings.com" rel="home" />',
7272
'<link href="http://cool-runnings.com/nectar" rel="canonical" />',
7373
'<link type="text/plain" rel="author" href="http://cool-runnings.com/humans.txt" />',
7474
])->implode('');
@@ -145,7 +145,7 @@ public function it_queries_for_entry_seo_cascade_so_user_can_render_custom_meta(
145145
'alternate_locales' => [],
146146
'prev_url' => null,
147147
'next_url' => null,
148-
'home_url' => 'http://cool-runnings.com/',
148+
'home_url' => 'http://cool-runnings.com',
149149
'humans_txt' => 'http://cool-runnings.com/humans.txt',
150150
'twitter_card' => 'summary_large_image',
151151
'twitter_handle' => null,
@@ -182,7 +182,7 @@ public function it_queries_for_term_seo_meta_html()
182182
'<meta property="og:locale" content="en_US" />',
183183
'<meta name="twitter:card" content="summary_large_image" />',
184184
'<meta name="twitter:title" content="Dance" />',
185-
'<link href="http://cool-runnings.com/" rel="home" />',
185+
'<link href="http://cool-runnings.com" rel="home" />',
186186
'<link href="http://cool-runnings.com/topics/dance" rel="canonical" />',
187187
'<link type="text/plain" rel="author" href="http://cool-runnings.com/humans.txt" />',
188188
])->implode('');
@@ -259,7 +259,7 @@ public function it_queries_for_term_seo_cascade_so_user_can_render_custom_meta()
259259
'alternate_locales' => [],
260260
'prev_url' => null,
261261
'next_url' => null,
262-
'home_url' => 'http://cool-runnings.com/',
262+
'home_url' => 'http://cool-runnings.com',
263263
'humans_txt' => 'http://cool-runnings.com/humans.txt',
264264
'twitter_card' => 'summary_large_image',
265265
'twitter_handle' => null,

tests/HumansTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function it_outputs_humans_txt()
3030
/* TEAM */
3131
3232
Creator: Site Name
33-
URL: http://cool-runnings.com/
33+
URL: http://cool-runnings.com
3434
Description: I see a bad-ass mother.
3535
3636
/* THANKS */

tests/Localized/GraphQLTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function it_queries_multisite_for_canonical_url_and_alternate_locales_in_
4444
'<meta name="twitter:card" content="summary_large_image" />',
4545
'<meta name="twitter:title" content="Les Nectar of the Gods" />',
4646
'<meta name="twitter:description" content="The day started just like any other. Wake up at 5:30am, brush my teeth, bathe in a tub of warm milk, and trim my toenails while quietly resenting the fact that Flipper was on Nickelodeon at this hour instead of Rocko&#039;s Modern Life. That would have to wait until 5:30pm for that, and I am impatient.In truth, the day wou..." />',
47-
'<link href="http://cool-runnings.com/" rel="home" />',
47+
'<link href="http://cool-runnings.com" rel="home" />',
4848
'<link href="http://cool-runnings.com/fr/nectar" rel="canonical" />',
4949
'<link rel="alternate" href="http://cool-runnings.com/fr/nectar" hreflang="fr" />',
5050
'<link rel="alternate" href="http://cool-runnings.com/nectar" hreflang="en" />',

tests/MetaTagTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function it_generates_normalized_meta($viewType)
7171
<meta name="twitter:card" content="summary_large_image" />
7272
<meta name="twitter:title" content="Home" />
7373
<meta name="twitter:description" content="I see a bad-ass mother." />
74-
<link href="http://cool-runnings.com/" rel="home" />
74+
<link href="http://cool-runnings.com" rel="home" />
7575
<link href="http://cool-runnings.com" rel="canonical" />
7676
<link type="text/plain" rel="author" href="http://cool-runnings.com/humans.txt" />
7777
EOT;
@@ -103,7 +103,7 @@ public function it_generates_normalized_meta_when_visiting_statamic_route_with_r
103103
<meta name="twitter:card" content="summary_large_image" />
104104
<meta name="twitter:title" content="The View" />
105105
<meta name="twitter:description" content="A wonderful view!" />
106-
<link href="http://cool-runnings.com/" rel="home" />
106+
<link href="http://cool-runnings.com" rel="home" />
107107
<link href="http://cool-runnings.com/the-view" rel="canonical" />
108108
<link type="text/plain" rel="author" href="http://cool-runnings.com/humans.txt" />
109109
EOT;
@@ -383,7 +383,7 @@ public function it_generates_home_url_for_entry_meta($viewType)
383383

384384
$response = $this->get('/about');
385385
$response->assertSee("<h1>{$viewType}</h1>", false);
386-
$response->assertSee('<link href="http://cool-runnings.com/" rel="home" />', false);
386+
$response->assertSee('<link href="http://cool-runnings.com" rel="home" />', false);
387387
}
388388

389389
/**
@@ -744,7 +744,7 @@ public function it_generates_normalized_meta_from_custom_site_defaults_path($vie
744744
<meta name="twitter:card" content="summary_large_image" />
745745
<meta name="twitter:title" content="Home" />
746746
<meta name="twitter:description" content="I see a bad-ass mother." />
747-
<link href="http://cool-runnings.com/" rel="home" />
747+
<link href="http://cool-runnings.com" rel="home" />
748748
<link href="http://cool-runnings.com" rel="canonical" />
749749
<link type="text/plain" rel="author" href="http://cool-runnings.com/humans.txt" />
750750
EOT;

0 commit comments

Comments
 (0)