diff --git a/README.md b/README.md index b83191e..0e9a0db 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,6 @@ Sitemap::create() ->add(Url::create('/home') ->setLastModificationDate(Carbon::yesterday()) - ->setChangeFrequency(Url::CHANGE_FREQUENCY_YEARLY) - ->setPriority(0.1)) ->add(...) @@ -40,8 +38,6 @@ SitemapGenerator::create('https://example.com') ->getSitemap() ->add(Url::create('/extra-page') ->setLastModificationDate(Carbon::yesterday()) - ->setChangeFrequency(Url::CHANGE_FREQUENCY_YEARLY) - ->setPriority(0.1)) ->add(...) @@ -84,9 +80,7 @@ class Post extends Model implements Sitemapable // Return with fine-grained control: return Url::create(route('blog.post.show', $this)) - ->setLastModificationDate(Carbon::create($this->updated_at)) - ->setChangeFrequency(Url::CHANGE_FREQUENCY_YEARLY) - ->setPriority(0.1); + ->setLastModificationDate(Carbon::create($this->updated_at)); } } ``` @@ -209,14 +203,10 @@ The generated sitemap will look similar to this: https://example.com 2016-01-01T00:00:00+00:00 - daily - 0.8 https://example.com/page 2016-01-01T00:00:00+00:00 - daily - 0.8 ... @@ -260,26 +250,6 @@ return [ ]; ``` -#### Changing properties - -To change the `lastmod`, `changefreq` and `priority` of the contact page: - -```php -use Carbon\Carbon; -use Spatie\Sitemap\SitemapGenerator; -use Spatie\Sitemap\Tags\Url; - -SitemapGenerator::create('https://example.com') - ->hasCrawled(function (Url $url) { - if ($url->segment(1) === 'contact') { - $url->setPriority(0.9) - ->setLastModificationDate(Carbon::create('2016', '1', '1')); - } - - return $url; - }) - ->writeToFile($sitemapPath); -``` #### Leaving out some links @@ -366,7 +336,6 @@ use Spatie\Sitemap\Tags\Url; SitemapGenerator::create('https://example.com') ->getSitemap() // here we add one extra link, but you can add as many as you'd like - ->add(Url::create('/extra-page')->setPriority(0.5)) ->writeToFile($sitemapPath); ``` @@ -381,7 +350,6 @@ use Spatie\Sitemap\Tags\Url; SitemapGenerator::create('https://example.com') ->getSitemap() // here we add one extra link, but you can add as many as you'd like - ->add(Url::create('/extra-page')->setPriority(0.5)->addAlternate('/extra-pagina', 'nl')) ->writeToFile($sitemapPath); ``` @@ -559,6 +527,7 @@ protected function schedule(Schedule $schedule) $schedule->command('sitemap:generate')->daily(); ... } + ``` ## Changelog