Skip to content

Commit d2c5220

Browse files
committed
Change config option site.site_url to site.url
This makes it match both the site.name and the Laravel config, adding consistency.
1 parent f03efaf commit d2c5220

17 files changed

+57
-57
lines changed

RELEASE_NOTES.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ This update makes breaking changes to the configuration. You will need to update
1212
- internal: Refactor navigation menu components and improve link helpers
1313

1414
- Moved config option `hyde.name` to `site.name`
15-
- Moved config option `hyde.site_url` to `site.site_url`
15+
- Moved config option `hyde.site_url` to `site.url`
1616
- Moved config option `hyde.pretty_urls` to `site.pretty_urls`
1717
- Moved config option `hyde.generate_sitemap` to `site.generate_sitemap`
1818
- Moved config option `hyde.language` to `site.language`
1919
- Moved config option `hyde.output_directory` to `site.output_directory`
2020

21-
- The default `site.site_url` is now `http://localhost` instead of `null`
21+
- The default `site.url` is now `http://localhost` instead of `null`
2222

2323
### Deprecated
2424
- for soon-to-be removed features.
@@ -42,7 +42,7 @@ Site-specific config options have been moved from `config/hyde.php` to `config/s
4242
The following configuration options have been moved. The actual usages remain the same, so you can upgrade by using copying over these options to the new file.
4343

4444
- `hyde.name`
45-
- `hyde.site_url`
45+
- `hyde.site_url` (is now just `site.url`)
4646
- `hyde.pretty_urls`
4747
- `hyde.generate_sitemap`
4848
- `hyde.language`

_pages/404.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
Sorry, the page you are looking for could not be found.
3232
</p>
3333

34-
<a href="{{ config('site.site_url') ?? '/' }}">
34+
<a href="{{ config('site.url') ?? '/' }}">
3535
<button
3636
class="bg-transparent text-grey-darkest font-bold uppercase tracking-wide py-3 px-6 border-2 border-grey-light hover:border-grey rounded-lg">
3737
Go Home

packages/framework/resources/views/pages/404.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
Sorry, the page you are looking for could not be found.
3232
</p>
3333

34-
<a href="{{ config('site.site_url') ?? '/' }}">
34+
<a href="{{ config('site.url') ?? '/' }}">
3535
<button
3636
class="bg-transparent text-grey-darkest font-bold uppercase tracking-wide py-3 px-6 border-2 border-grey-light hover:border-grey rounded-lg">
3737
Go Home

packages/framework/src/Concerns/Internal/FileHelpers.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ public static function image(string $name, string $current = null): string
144144
*/
145145
public static function uriPath(?string $path = ''): string|false
146146
{
147-
if (config('site.site_url', false)) {
148-
return rtrim(config('site.site_url'), '/').'/'.(trim($path, '/') ?? '');
147+
if (config('site.url', false)) {
148+
return rtrim(config('site.url'), '/').'/'.(trim($path, '/') ?? '');
149149
}
150150

151151
return false;

packages/framework/src/Services/RssFeedService.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public static function getLink(): string
123123
{
124124
return static::xmlEscape(
125125
rtrim(
126-
config('site.site_url') ?? 'http://localhost',
126+
config('site.url') ?? 'http://localhost',
127127
'/'
128128
)
129129
);

packages/framework/tests/Feature/Commands/HydeBuildRssFeedCommandTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class HydeBuildRssFeedCommandTest extends TestCase
1414
{
1515
public function test_rss_feed_is_not_generated_when_conditions_are_not_met()
1616
{
17-
config(['site.site_url' => '']);
17+
config(['site.url' => '']);
1818
config(['hyde.generate_rss_feed' => false]);
1919

2020
unlinkIfExists(Hyde::path('_site/feed.xml'));
@@ -26,7 +26,7 @@ public function test_rss_feed_is_not_generated_when_conditions_are_not_met()
2626

2727
public function test_rss_feed_is_generated_when_conditions_are_met()
2828
{
29-
config(['site.site_url' => 'https://example.com']);
29+
config(['site.url' => 'https://example.com']);
3030
config(['hyde.generate_rss_feed' => true]);
3131

3232
unlinkIfExists(Hyde::path('_site/feed.xml'));
@@ -40,7 +40,7 @@ public function test_rss_feed_is_generated_when_conditions_are_met()
4040

4141
public function test_rss_filename_can_be_changed()
4242
{
43-
config(['site.site_url' => 'https://example.com']);
43+
config(['site.url' => 'https://example.com']);
4444
config(['hyde.generate_rss_feed' => true]);
4545
config(['hyde.rss_filename' => 'blog.xml']);
4646

packages/framework/tests/Feature/Commands/HydeBuildSitemapCommandTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class HydeBuildSitemapCommandTest extends TestCase
1212
{
1313
public function test_sitemap_is_generated_when_conditions_are_met()
1414
{
15-
config(['site.site_url' => 'https://example.com']);
15+
config(['site.url' => 'https://example.com']);
1616
config(['site.generate_sitemap' => true]);
1717

1818
unlinkIfExists(Hyde::path('_site/sitemap.xml'));
@@ -27,7 +27,7 @@ public function test_sitemap_is_generated_when_conditions_are_met()
2727

2828
public function test_sitemap_is_not_generated_when_conditions_are_not_met()
2929
{
30-
config(['site.site_url' => '']);
30+
config(['site.url' => '']);
3131
config(['site.generate_sitemap' => false]);
3232
unlinkIfExists(Hyde::path('_site/sitemap.xml'));
3333

@@ -40,7 +40,7 @@ public function test_sitemap_is_not_generated_when_conditions_are_not_met()
4040

4141
public function test_sitemap_returns_helpful_error_message_when_no_site_url_is_configured()
4242
{
43-
config(['site.site_url' => '']);
43+
config(['site.url' => '']);
4444
config(['site.generate_sitemap' => true]);
4545

4646
unlinkIfExists(Hyde::path('_site/sitemap.xml'));
@@ -54,7 +54,7 @@ public function test_sitemap_returns_helpful_error_message_when_no_site_url_is_c
5454

5555
public function test_sitemap_returns_helpful_error_message_when_sitemap_generation_is_disabled()
5656
{
57-
config(['site.site_url' => 'https://example.com']);
57+
config(['site.url' => 'https://example.com']);
5858
config(['site.generate_sitemap' => false]);
5959

6060
unlinkIfExists(Hyde::path('_site/sitemap.xml'));
@@ -67,7 +67,7 @@ public function test_sitemap_returns_helpful_error_message_when_sitemap_generati
6767

6868
public function test_sitemap_returns_helpful_error_message_when_simplexml_is_not_installed()
6969
{
70-
config(['site.site_url' => null]);
70+
config(['site.url' => null]);
7171
config(['testing.mock_disabled_extensions' => true]);
7272

7373
$this->artisan('build:sitemap')

packages/framework/tests/Feature/Concerns/GeneratesPageMetadataTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function setUp(): void
2424
{
2525
parent::setUp();
2626

27-
Config::set('site.site_url', null);
27+
Config::set('site.url', null);
2828
}
2929

3030
protected function tearDown(): void
@@ -71,7 +71,7 @@ public function test_get_meta_properties_returns_base_array_when_initialized_wit
7171
// Note that this currently assumes that the object using it is a Blog Post.
7272
public function test_get_meta_properties_contains_og_url_when_uri_path_set()
7373
{
74-
Config::set('site.site_url', 'https://example.com/foo');
74+
Config::set('site.url', 'https://example.com/foo');
7575
$this->slug = 'bar';
7676
$this->constructMetadata();
7777

packages/framework/tests/Feature/Concerns/HasPageMetadataTest.php

+12-12
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected function setUp(): void
1919
parent::setUp();
2020

2121
config(['hyde.meta' => []]);
22-
config(['site.site_url' => null]);
22+
config(['site.url' => null]);
2323
config(['site.pretty_urls' => false]);
2424
config(['site.generate_sitemap' => false]);
2525
}
@@ -38,15 +38,15 @@ protected function makePage(): AbstractPage
3838
public function test_get_canonical_url_returns_url_for_top_level_page()
3939
{
4040
$page = $this->makePage();
41-
config(['site.site_url' => 'https://example.com']);
41+
config(['site.url' => 'https://example.com']);
4242

4343
$this->assertEquals('https://example.com/foo.html', $page->getCanonicalUrl());
4444
}
4545

4646
public function test_get_canonical_url_returns_pretty_url_for_top_level_page()
4747
{
4848
$page = $this->makePage();
49-
config(['site.site_url' => 'https://example.com']);
49+
config(['site.url' => 'https://example.com']);
5050
config(['site.pretty_urls' => true]);
5151

5252
$this->assertEquals('https://example.com/foo', $page->getCanonicalUrl());
@@ -66,7 +66,7 @@ public function getCurrentPagePath(): string
6666
return 'bar/'.$this->slug;
6767
}
6868
};
69-
config(['site.site_url' => 'https://example.com']);
69+
config(['site.url' => 'https://example.com']);
7070

7171
$this->assertEquals('https://example.com/bar/foo.html', $page->getCanonicalUrl());
7272
}
@@ -85,15 +85,15 @@ public function getCurrentPagePath(): string
8585
return 'bar/baz/'.$this->slug;
8686
}
8787
};
88-
config(['site.site_url' => 'https://example.com']);
88+
config(['site.url' => 'https://example.com']);
8989

9090
$this->assertEquals('https://example.com/bar/baz/foo.html', $page->getCanonicalUrl());
9191
}
9292

9393
public function test_can_use_canonical_url_returns_true_when_both_uri_path_and_slug_is_set()
9494
{
9595
$page = $this->makePage();
96-
config(['site.site_url' => 'https://example.com']);
96+
config(['site.url' => 'https://example.com']);
9797

9898
$this->assertTrue($page->canUseCanonicalUrl());
9999
}
@@ -120,7 +120,7 @@ public function test_can_use_canonical_url_returns_false_when_only_one_condition
120120
public string $slug;
121121
public static string $outputDirectory = '';
122122
};
123-
config(['site.site_url' => 'https://example.com']);
123+
config(['site.url' => 'https://example.com']);
124124

125125
$this->assertFalse($page->canUseCanonicalUrl());
126126

@@ -130,15 +130,15 @@ public function test_can_use_canonical_url_returns_false_when_only_one_condition
130130

131131
public string $slug = 'foo';
132132
};
133-
config(['site.site_url' => null]);
133+
config(['site.url' => null]);
134134

135135
$this->assertFalse($page->canUseCanonicalUrl());
136136
}
137137

138138
public function test_render_page_metadata_returns_string_with_merged_metadata()
139139
{
140140
$page = $this->makePage();
141-
config(['site.site_url' => 'https://example.com']);
141+
config(['site.url' => 'https://example.com']);
142142

143143
config(['hyde.meta' => [
144144
Meta::name('foo', 'bar'),
@@ -174,7 +174,7 @@ public function test_get_dynamic_metadata_only_adds_canonical_if_conditions_are_
174174
public function test_get_dynamic_metadata_adds_canonical_url_when_conditions_are_met()
175175
{
176176
$page = $this->makePage();
177-
config(['site.site_url' => 'https://example.com']);
177+
config(['site.url' => 'https://example.com']);
178178

179179
config(['hyde.meta' => [
180180
Meta::name('foo', 'bar'),
@@ -191,7 +191,7 @@ public function test_get_dynamic_metadata_adds_sitemap_link_when_conditions_are_
191191
{
192192
use HasPageMetadata;
193193
};
194-
config(['site.site_url' => 'https://example.com']);
194+
config(['site.url' => 'https://example.com']);
195195
config(['site.generate_sitemap' => true]);
196196

197197
$this->assertEquals(['<link rel="sitemap" type="application/xml" title="Sitemap" href="https://example.com/sitemap.xml" />'],
@@ -205,7 +205,7 @@ public function test_get_dynamic_metadata_does_not_add_sitemap_link_when_conditi
205205
{
206206
use HasPageMetadata;
207207
};
208-
config(['site.site_url' => 'https://example.com']);
208+
config(['site.url' => 'https://example.com']);
209209
config(['site.generate_sitemap' => false]);
210210

211211
$this->assertEquals([],

packages/framework/tests/Feature/Services/BuildHookServiceTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class BuildHookServiceTest extends TestCase
2121
*/
2222
public function test_build_command_can_run_post_build_tasks()
2323
{
24-
config(['site.site_url' => 'foo']);
24+
config(['site.url' => 'foo']);
2525

2626
$this->artisan('build')
2727
->expectsOutputToContain('Generating sitemap')

packages/framework/tests/Feature/Services/RssFeedServiceTest.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function test_xml_element_has_channel_element()
3333
public function test_xml_channel_element_has_required_elements()
3434
{
3535
config(['site.name' => 'Test Blog']);
36-
config(['site.site_url' => 'https://example.com']);
36+
config(['site.url' => 'https://example.com']);
3737

3838
$service = new RssFeedService();
3939
$this->assertObjectHasAttribute('title', $service->feed->channel);
@@ -47,7 +47,7 @@ public function test_xml_channel_element_has_required_elements()
4747

4848
public function test_xml_channel_element_has_additional_elements()
4949
{
50-
config(['site.site_url' => 'https://example.com']);
50+
config(['site.url' => 'https://example.com']);
5151

5252
$service = new RssFeedService();
5353
$this->assertObjectHasAttribute('link', $service->feed->channel);
@@ -63,7 +63,7 @@ public function test_xml_channel_element_has_additional_elements()
6363
public function test_xml_channel_data_can_be_customized()
6464
{
6565
config(['site.name' => 'Foo']);
66-
config(['site.site_url' => 'https://blog.foo.com/bar']);
66+
config(['site.url' => 'https://blog.foo.com/bar']);
6767
config(['hyde.rss_description' => 'Foo is a web log about stuff']);
6868

6969
$service = new RssFeedService();
@@ -90,7 +90,7 @@ public function test_markdown_blog_posts_are_added_to_rss_feed_through_autodisco
9090
MD
9191
);
9292

93-
config(['site.site_url' => 'https://example.com']);
93+
config(['site.url' => 'https://example.com']);
9494

9595
file_put_contents(Hyde::path('_media/rss-test.jpg'), 'statData'); // 8 bytes to test stat gets file length
9696

@@ -128,19 +128,19 @@ public function test_generate_feed_helper_returns_xml_string()
128128

129129
public function test_can_generate_sitemap_helper_returns_true_if_hyde_has_base_url()
130130
{
131-
config(['site.site_url' => 'foo']);
131+
config(['site.url' => 'foo']);
132132
$this->assertTrue(RssFeedService::canGenerateFeed());
133133
}
134134

135135
public function test_can_generate_sitemap_helper_returns_false_if_hyde_does_not_have_base_url()
136136
{
137-
config(['site.site_url' => '']);
137+
config(['site.url' => '']);
138138
$this->assertFalse(RssFeedService::canGenerateFeed());
139139
}
140140

141141
public function test_can_generate_sitemap_helper_returns_false_if_sitemaps_are_disabled_in_config()
142142
{
143-
config(['site.site_url' => 'foo']);
143+
config(['site.url' => 'foo']);
144144
config(['hyde.generate_rss_feed' => false]);
145145
$this->assertFalse(RssFeedService::canGenerateFeed());
146146
}

packages/framework/tests/Feature/Services/SitemapServiceTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -93,27 +93,27 @@ public function test_generate_sitemap_shorthand_method_returns_xml_string()
9393

9494
public function test_can_generate_sitemap_helper_returns_true_if_hyde_has_base_url()
9595
{
96-
config(['site.site_url' => 'foo']);
96+
config(['site.url' => 'foo']);
9797
$this->assertTrue(SitemapService::canGenerateSitemap());
9898
}
9999

100100
public function test_can_generate_sitemap_helper_returns_false_if_hyde_does_not_have_base_url()
101101
{
102-
config(['site.site_url' => '']);
102+
config(['site.url' => '']);
103103
$this->assertFalse(SitemapService::canGenerateSitemap());
104104
}
105105

106106
public function test_can_generate_sitemap_helper_returns_false_if_sitemaps_are_disabled_in_config()
107107
{
108-
config(['site.site_url' => 'foo']);
108+
config(['site.url' => 'foo']);
109109
config(['site.generate_sitemap' => false]);
110110
$this->assertFalse(SitemapService::canGenerateSitemap());
111111
}
112112

113113
public function test_url_item_is_generated_correctly()
114114
{
115115
config(['site.pretty_urls' => false]);
116-
config(['site.site_url' => 'https://example.com']);
116+
config(['site.url' => 'https://example.com']);
117117
Hyde::touch(('_pages/0-test.blade.php'));
118118

119119
$service = new SitemapService();
@@ -130,7 +130,7 @@ public function test_url_item_is_generated_correctly()
130130
public function test_url_item_is_generated_with_pretty_urls_if_enabled()
131131
{
132132
config(['site.pretty_urls' => true]);
133-
config(['site.site_url' => 'https://example.com']);
133+
config(['site.url' => 'https://example.com']);
134134
Hyde::touch(('_pages/0-test.blade.php'));
135135

136136
$service = new SitemapService();
@@ -144,7 +144,7 @@ public function test_url_item_is_generated_with_pretty_urls_if_enabled()
144144

145145
public function test_all_route_types_are_discovered()
146146
{
147-
config(['site.site_url' => 'foo']);
147+
config(['site.url' => 'foo']);
148148
Hyde::unlink(['_pages/index.blade.php', '_pages/404.blade.php']);
149149

150150
$files = [

packages/framework/tests/Feature/Services/ValidationServiceTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ public function test_check_site_has_an_app_css_stylesheet_can_fail()
118118

119119
public function test_check_site_has_a_base_url_set_can_pass()
120120
{
121-
config(['site.site_url' => 'https://example.com']);
121+
config(['site.url' => 'https://example.com']);
122122
$this->test('check_site_has_a_base_url_set', 0);
123123
}
124124

125125
public function test_check_site_has_a_base_url_set_can_fail()
126126
{
127-
config(['site.site_url' => null]);
127+
config(['site.url' => null]);
128128
$this->test('check_site_has_a_base_url_set', 2);
129129
}
130130

0 commit comments

Comments
 (0)