Skip to content

Commit

Permalink
fix: robots and sitemap served at /storage path (resolves #1998) (#2000)
Browse files Browse the repository at this point in the history
fix: robots and sitemap served at /storage path
  • Loading branch information
jobara committed Nov 22, 2023
1 parent 22914fe commit d6d1d5e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/node_modules
/public/hot
/public/storage
/public/robots.txt
/public/sitemap.xml
/storage/*.key
/vendor
.DS_Store
Expand Down
2 changes: 2 additions & 0 deletions config/filesystems.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@

'links' => [
public_path('storage') => storage_path('app/public'),
public_path('sitemap.xml') => storage_path('app/public/sitemap.xml'),
public_path('robots.txt') => storage_path('app/public/robots.txt'),
],

];
27 changes: 0 additions & 27 deletions tests/Feature/Console/DeployLocalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,10 @@

use function Pest\Laravel\artisan;

beforeEach(function () {
$this->disk = Storage::disk('public');
$this->robots = 'robots.txt';
$this->robotsOriginal = 'robots.original.txt';
$this->sitemap = 'sitemap.xml';
$this->sitemapOriginal = 'sitemap.original.xml';

if ($this->disk->fileExists($this->robots)) {
Storage::disk('public')->move($this->robots, $this->robotsOriginal);
}

if ($this->disk->fileExists($this->sitemap)) {
Storage::disk('public')->move($this->sitemap, $this->sitemapOriginal);
}
});

afterEach(function () {
artisan('optimize:clear');
artisan('icons:clear');
artisan('event:clear');

Storage::disk('public')->delete($this->robots);
Storage::disk('public')->delete($this->sitemap);

if ($this->disk->fileExists($this->robotsOriginal)) {
Storage::disk('public')->move($this->robotsOriginal, $this->robots);
}

if ($this->disk->fileExists($this->sitemapOriginal)) {
Storage::disk('public')->move($this->sitemapOriginal, $this->sitemap);
}
});

test('Completes successfully', function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/Console/GenerateSitemapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

$this->disk->assertExists($this->sitemap);

artisan('seo:generate')->assertSuccessful();
artisan('seo:generate-sitemap')->assertSuccessful();

$this->disk->assertExists($this->sitemap);
});

0 comments on commit d6d1d5e

Please sign in to comment.