Skip to content

Commit

Permalink
Allow priority of 0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bakerkretzmar committed Sep 6, 2023
1 parent c9278df commit 1e92dc8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 0 additions & 2 deletions resources/views/url.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
@if (! empty($tag->changeFrequency))
<changefreq>{{ $tag->changeFrequency }}</changefreq>
@endif
@if (! empty($tag->priority))
<priority>{{ number_format($tag->priority,1) }}</priority>
@endif
@each('sitemap::image', $tag->images, 'image')
@each('sitemap::video', $tag->videos, 'video')
</url>
12 changes: 12 additions & 0 deletions tests/SitemapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@
assertMatchesXmlSnapshot($this->sitemap->render());
});

it('can render an url with priority 0', function () {
$this->sitemap
->add(
Url::create('/home')
->setLastModificationDate($this->now->subDay())
->setChangeFrequency(Url::CHANGE_FREQUENCY_YEARLY)
->setPriority(0.0)
);

assertMatchesXmlSnapshot($this->sitemap->render());
});

it('can determine if it contains a given url', function () {
$this->sitemap
->add('/page1')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url>
<loc>http://localhost/home</loc>
<lastmod>2015-12-31T00:00:00+00:00</lastmod>
<changefreq>yearly</changefreq>
<priority>0.0</priority>
</url>
</urlset>

0 comments on commit 1e92dc8

Please sign in to comment.