Skip to content

Commit

Permalink
Add the Site URL setting
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Mar 23, 2022
1 parent 59b99d7 commit 05211b9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# SITE_URL=https://example.org

# If you want to use Torchlight.dev, enter your API token here to automatically enable it
TORCHLIGHT_TOKEN=torch_
16 changes: 16 additions & 0 deletions config/hyde.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@
'name' => 'HydePHP',


/*
|--------------------------------------------------------------------------
| Site URL
|--------------------------------------------------------------------------
|
| If you want, you can set your site's URL here or in the .env file.
|
| The URL will then be used in meta tags to create permalinks.
| If you are serving your site from a subdirectory, you will
| need to include that in the path without a trailing slash.
|
| Example: https://example.com/blog
|
*/
'site_url' => env('SITE_URL', null),

/*
|--------------------------------------------------------------------------
| Features
Expand Down
20 changes: 20 additions & 0 deletions tests/Validators/CheckIfSiteUrlIsSetTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

use Illuminate\Contracts\Console\Kernel;

beforeEach(function () {
$app = require __DIR__.'/../../bootstrap/app.php';

$app->make(Kernel::class)->bootstrap();

return $app;
});

test('check if site url is set', function () {
$assertion = (bool) Hyde::uriPath();
if (!$assertion) {
$this->addWarning('Did not find a Site URL in .env. Adding it may improve SEO.');
} else {
$this->assertTrue($assertion);
}
})->group('validators');

0 comments on commit 05211b9

Please sign in to comment.