Fix sitemap output
This commit is contained in:
parent
340342d047
commit
0aa80817ea
1 changed files with 9 additions and 2 deletions
|
|
@ -4,6 +4,7 @@ namespace LDC\SitemapGenerator\Lib;
|
|||
|
||||
use Illuminate\Support\Collection;
|
||||
use LDC\SitemapGenerator\Exceptions\SitemapResolveUrlException;
|
||||
use Spatie\Sitemap\Sitemap as SpatieSitemap;
|
||||
use Spatie\Sitemap\Tags\Url;
|
||||
use Symfony\Component\Mime\MimeTypes;
|
||||
|
||||
|
|
@ -40,11 +41,17 @@ class Sitemap
|
|||
$queries = \collect(\parse_url($tag->getUrl(), \PHP_URL_QUERY))->filter();
|
||||
// ! Ignore null from previous or tags with urls that have Queries.
|
||||
if (!$tag or $queries->count()) {
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
return $tag;
|
||||
return true;
|
||||
});
|
||||
$this->assignPrioritiesAndFrequencies();
|
||||
|
||||
// *Assign new sitemap
|
||||
$this->sitemap = SpatieSitemap::create();
|
||||
$this->tagList->each(function (Tag $tag) {
|
||||
$this->sitemap->add($tag);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue