Skip to content

Commit

Permalink
Replace config('site') calls with config('hyde')
Browse files Browse the repository at this point in the history
Replace `config('site')` calls with `config('hyde')`

Replace `config(['site'])` calls with `config(['hyde'])`

Replace `Config::get('site')` calls with `Config::get('hyde')`
  • Loading branch information
caendesilva committed Feb 10, 2023
1 parent e8a65fe commit 73143af
Show file tree
Hide file tree
Showing 49 changed files with 165 additions and 165 deletions.
2 changes: 1 addition & 1 deletion _pages/404.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
Sorry, the page you are looking for could not be found.
</p>

<a href="{{ config('site.url') ?? '/' }}">
<a href="{{ config('hyde.url') ?? '/' }}">
<button
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">
Go Home
Expand Down
2 changes: 1 addition & 1 deletion config/docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
|
*/

'header_title' => config('site.name', 'HydePHP').' Docs',
'header_title' => config('hyde.name', 'HydePHP').' Docs',

/*
|--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion config/hyde.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
// Meta::name('description', 'My Hyde Blog'),
// Meta::name('keywords', 'Static Sites, Blogs, Documentation'),
Meta::name('generator', 'HydePHP '.Hyde\Hyde::version()),
Meta::property('site_name', config('site.name', 'HydePHP')),
Meta::property('site_name', config('hyde.name', 'HydePHP')),
],

/*
Expand Down
2 changes: 1 addition & 1 deletion docs/digging-deeper/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ navigation:
Hyde favours <a href="https://en.wikipedia.org/wiki/Convention_over_configuration">"Convention over Configuration"</a>
and comes preconfigured with sensible defaults. However, Hyde also strives to be modular and endlessly customizable if you need it. This page guides you through the many options available!

When referencing configuration options, we often use "dot notation" to specify the configuration file. For example, <code>config('site.name')</code> means that we are looking for the <code>name</code> option in the <code>config/site.php</code> file.
When referencing configuration options, we often use "dot notation" to specify the configuration file. For example, <code>config('hyde.name')</code> means that we are looking for the <code>name</code> option in the <code>config/site.php</code> file.

If you want to reference these configuration options in your Blade views, or other integrations, please take a look at the [Laravel Documentation](https://laravel.com/docs/9.x/configuration).

Expand Down
2 changes: 1 addition & 1 deletion packages/framework/config/docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
|
*/

'header_title' => config('site.name', 'HydePHP').' Docs',
'header_title' => config('hyde.name', 'HydePHP').' Docs',

/*
|--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/config/hyde.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
// Meta::name('description', 'My Hyde Blog'),
// Meta::name('keywords', 'Static Sites, Blogs, Documentation'),
Meta::name('generator', 'HydePHP '.Hyde\Hyde::version()),
Meta::property('site_name', config('site.name', 'HydePHP')),
Meta::property('site_name', config('hyde.name', 'HydePHP')),
],

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<a href="{{ Route::get('index') }}" class="font-bold px-4" aria-label="Home page">
{{ config('site.name', 'HydePHP') }}
{{ config('hyde.name', 'HydePHP') }}
</a>
2 changes: 1 addition & 1 deletion packages/framework/resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="{{ config('site.language', 'en') }}">
<html lang="{{ config('hyde.language', 'en') }}">
<head>
@include('hyde::layouts.head')
</head>
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/resources/views/layouts/docs.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="{{ config('site.language', 'en') }}">
<html lang="{{ config('hyde.language', 'en') }}">
<head>
@include('hyde::layouts.head')
</head>
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/resources/views/pages/404.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
Sorry, the page you are looking for could not be found.
</p>

<a href="{{ config('site.url') ?? '/' }}">
<a href="{{ config('hyde.url') ?? '/' }}">
<button
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">
Go Home
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected function runPreBuildActions(): void
if ($this->option('pretty-urls')) {
$this->info('Generating site with pretty URLs');
$this->newLine();
Config::set(['site.pretty_urls' => true]);
Config::set(['hyde.pretty_urls' => true]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/framework/src/Facades/Features.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public static function torchlight(): string
public static function sitemap(): bool
{
return static::resolveMockedInstance('sitemap') ?? Hyde::hasSiteUrl()
&& config('site.generate_sitemap', true)
&& config('hyde.generate_sitemap', true)
&& extension_loaded('simplexml');
}

Expand Down
6 changes: 3 additions & 3 deletions packages/framework/src/Facades/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ final class Site
{
public static function url(): ?string
{
return config('site.url');
return config('hyde.url');
}

public static function name(): ?string
{
return config('site.name');
return config('hyde.name');
}

public static function language(): ?string
{
return config('site.language');
return config('hyde.language');
}

public static function metadata(): GlobalMetadataBag
Expand Down
6 changes: 3 additions & 3 deletions packages/framework/src/Foundation/Hyperlinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(HydeKernel $kernel)
*/
public function formatLink(string $destination): string
{
if (config('site.pretty_urls', false) === true) {
if (config('hyde.pretty_urls', false) === true) {
if (str_ends_with($destination, '.html')) {
if ($destination === 'index.html') {
return '/';
Expand Down Expand Up @@ -108,7 +108,7 @@ public function image(string $name, bool $preferQualifiedUrl = false): string
*/
public function hasSiteUrl(): bool
{
return ! blank(config('site.url'));
return ! blank(config('hyde.url'));
}

/**
Expand All @@ -123,7 +123,7 @@ public function url(string $path = ''): string
$path = $this->formatLink(trim($path, '/'));

if ($this->hasSiteUrl()) {
return rtrim(rtrim((string) config('site.url'), '/')."/$path", '/');
return rtrim(rtrim((string) config('hyde.url'), '/')."/$path", '/');
}

throw new BaseUrlNotSetException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected function addBaseChannelItems(): void
$this->addChild($channel, 'title', Site::name());
$this->addChild($channel, 'link', Site::url());
$this->addChild($channel, 'description', $this->getDescription());
$this->addChild($channel, 'language', config('site.language', 'en'));
$this->addChild($channel, 'language', config('hyde.language', 'en'));
$this->addChild($channel, 'generator', 'HydePHP '.Hyde::version());
$this->addChild($channel, 'lastBuildDate', date(DATE_RSS));
}
Expand Down
4 changes: 2 additions & 2 deletions packages/framework/src/Framework/HydeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ public function register(): void
DocumentationPage::class => config('docs.output_directory', 'docs'),
]);

$this->storeCompiledSiteIn(config('site.output_directory', '_site'));
$this->storeCompiledSiteIn(config('hyde.output_directory', '_site'));

$this->useMediaDirectory(config('site.media_directory', '_media'));
$this->useMediaDirectory(config('hyde.media_directory', '_media'));

$this->discoverBladeViewsIn(BladePage::sourceDirectory());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected function getSearchContentForDocument(DocumentationPage $page): string

protected function formatDestination(string $slug): string
{
if (config('site.pretty_urls', false) === true) {
if (config('hyde.pretty_urls', false) === true) {
return $slug === 'index' ? '' : $slug;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class YamlConfigurationService
public static function boot(): void
{
if (static::hasFile()) {
Config::set('site', array_merge(
Config::get('site', []),
Config::set('hyde', array_merge(
Config::get('hyde', []),
static::getYaml()
));
}
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/src/Pages/Concerns/HydePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function getBladeView(): string
*/
public function htmlTitle(): string
{
return config('site.name', 'HydePHP').' - '.$this->title;
return config('hyde.name', 'HydePHP').' - '.$this->title;
}

public function metadata(): PageMetadataBag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BuildRssFeedCommandTest extends TestCase
{
public function test_rss_feed_is_generated_when_conditions_are_met()
{
config(['site.url' => 'https://example.com']);
config(['hyde.url' => 'https://example.com']);
config(['hyde.generate_rss_feed' => true]);
$this->file('_posts/foo.md');

Expand All @@ -28,7 +28,7 @@ public function test_rss_feed_is_generated_when_conditions_are_met()

public function test_rss_filename_can_be_changed()
{
config(['site.url' => 'https://example.com']);
config(['hyde.url' => 'https://example.com']);
config(['hyde.generate_rss_feed' => true]);
config(['hyde.rss_filename' => 'blog.xml']);
$this->file('_posts/foo.md');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class BuildSitemapCommandTest extends TestCase
{
public function test_sitemap_is_generated_when_conditions_are_met()
{
config(['site.url' => 'https://example.com']);
config(['site.generate_sitemap' => true]);
config(['hyde.url' => 'https://example.com']);
config(['hyde.generate_sitemap' => true]);

$this->assertFileDoesNotExist(Hyde::path('_site/sitemap.xml'));

Expand Down
8 changes: 4 additions & 4 deletions packages/framework/tests/Feature/ConfigurableFeaturesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ public function test_has_feature_returns_true_when_feature_is_enabled()

public function test_can_generate_sitemap_helper_returns_true_if_hyde_has_base_url()
{
config(['site.url' => 'foo']);
config(['hyde.url' => 'foo']);
$this->assertTrue(Features::sitemap());
}

public function test_can_generate_sitemap_helper_returns_false_if_hyde_does_not_have_base_url()
{
config(['site.url' => '']);
config(['hyde.url' => '']);
$this->assertFalse(Features::sitemap());
}

public function test_can_generate_sitemap_helper_returns_false_if_sitemaps_are_disabled_in_config()
{
config(['site.url' => 'foo']);
config(['site.generate_sitemap' => false]);
config(['hyde.url' => 'foo']);
config(['hyde.generate_sitemap' => false]);
$this->assertFalse(Features::sitemap());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function test_image_helper_returns_qualified_absolute_uri_when_requested_

public function test_image_helper_returns_default_relative_path_when_qualified_absolute_uri_is_requested_but_site_has_no_base_url()
{
config(['site.url' => null]);
config(['hyde.url' => null]);
$this->assertEquals('media/test.jpg', $this->class->image('test.jpg', true));
}

Expand Down
22 changes: 11 additions & 11 deletions packages/framework/tests/Feature/GlobalMetadataBagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public function test_site_metadata_automatically_adds_sitemap_when_enabled()
{
$this->emptyConfig();

config(['site.url' => 'foo']);
config(['site.generate_sitemap' => true]);
config(['hyde.url' => 'foo']);
config(['hyde.generate_sitemap' => true]);

$this->assertEquals('<link rel="sitemap" href="foo/sitemap.xml" type="application/xml" title="Sitemap">', GlobalMetadataBag::make()->render());
}
Expand All @@ -49,8 +49,8 @@ public function test_site_metadata_sitemap_uses_configured_site_url()
{
$this->emptyConfig();

config(['site.url' => 'bar']);
config(['site.generate_sitemap' => true]);
config(['hyde.url' => 'bar']);
config(['hyde.generate_sitemap' => true]);

$this->assertEquals('<link rel="sitemap" href="bar/sitemap.xml" type="application/xml" title="Sitemap">', GlobalMetadataBag::make()->render());
}
Expand All @@ -59,7 +59,7 @@ public function test_site_metadata_automatically_adds_rss_feed_when_enabled()
{
$this->emptyConfig();

config(['site.url' => 'foo']);
config(['hyde.url' => 'foo']);
config(['hyde.generate_rss_feed' => true]);
$this->file('_posts/foo.md');

Expand All @@ -70,7 +70,7 @@ public function test_site_metadata_rss_feed_uses_configured_site_url()
{
$this->emptyConfig();

config(['site.url' => 'bar']);
config(['hyde.url' => 'bar']);
config(['hyde.generate_rss_feed' => true]);
$this->file('_posts/foo.md');

Expand All @@ -81,8 +81,8 @@ public function test_site_metadata_rss_feed_uses_configured_site_name()
{
$this->emptyConfig();

config(['site.url' => 'foo']);
config(['site.name' => 'Site']);
config(['hyde.url' => 'foo']);
config(['hyde.name' => 'Site']);
config(['hyde.generate_rss_feed' => true]);
$this->file('_posts/foo.md');

Expand All @@ -93,7 +93,7 @@ public function test_site_metadata_rss_feed_uses_configured_rss_file_name()
{
$this->emptyConfig();

config(['site.url' => 'foo']);
config(['hyde.url' => 'foo']);
config(['hyde.rss_filename' => 'posts.rss']);
config(['hyde.generate_rss_feed' => true]);
$this->file('_posts/foo.md');
Expand Down Expand Up @@ -142,9 +142,9 @@ public function test_metadata_existing_in_the_current_page_is_not_added_regardle

protected function emptyConfig(): void
{
config(['site.url' => null]);
config(['hyde.url' => null]);
config(['hyde.meta' => []]);
config(['hyde.generate_rss_feed' => false]);
config(['site.generate_sitemap' => false]);
config(['hyde.generate_sitemap' => false]);
}
}
16 changes: 8 additions & 8 deletions packages/framework/tests/Feature/HydeKernelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ public function test_markdown_helper_converts_indented_markdown_to_html()

public function test_format_html_path_helper_formats_path_according_to_config_rules()
{
Config::set('site.pretty_urls', false);
Config::set('hyde.pretty_urls', false);
$this->assertSame('foo.html', Hyde::formatLink('foo.html'));
$this->assertSame('index.html', Hyde::formatLink('index.html'));

Config::set('site.pretty_urls', true);
Config::set('hyde.pretty_urls', true);
$this->assertSame('foo', Hyde::formatLink('foo.html'));
$this->assertSame('/', Hyde::formatLink('index.html'));
}
Expand Down Expand Up @@ -188,24 +188,24 @@ public function test_image_helper_supports_custom_media_directories()

public function test_has_site_url_helper_returns_boolean_value_for_when_config_setting_is_set()
{
Config::set('site.url', 'https://example.com');
Config::set('hyde.url', 'https://example.com');
$this->assertTrue(Hyde::hasSiteUrl());

Config::set('site.url', null);
Config::set('hyde.url', null);
$this->assertFalse(Hyde::hasSiteUrl());
}

public function test_url_returns_qualified_url_paths()
{
Config::set('site.url', 'https://example.com');
Config::set('hyde.url', 'https://example.com');
$this->assertSame('https://example.com', Hyde::url());
$this->assertSame('https://example.com/foo', Hyde::url('foo'));

Config::set('site.pretty_urls', false);
Config::set('hyde.pretty_urls', false);
$this->assertSame('https://example.com/foo.html', Hyde::url('foo.html'));
$this->assertSame('https://example.com/index.html', Hyde::url('index.html'));

Config::set('site.pretty_urls', true);
Config::set('hyde.pretty_urls', true);
$this->assertSame('https://example.com/foo', Hyde::url('foo.html'));
$this->assertSame('https://example.com', Hyde::url('index.html'));
}
Expand Down Expand Up @@ -414,7 +414,7 @@ public function test_media_output_directory_can_be_changed_in_configuration()
{
$this->assertEquals('_media', Hyde::getMediaDirectory());

config(['site.media_directory' => '_assets']);
config(['hyde.media_directory' => '_assets']);
(new HydeServiceProvider($this->app))->register();

$this->assertEquals('_assets', Hyde::getMediaDirectory());
Expand Down
Loading

0 comments on commit 73143af

Please sign in to comment.