Reputation: 853
I have created sitemap using this library https://github.com/spatie/laravel-sitemap but i don't want changefreq info.how to disable.can't find in repository
SitemapGenerator::create(url('/'))->writeToFile(public_path('sitemap.xml'));
Result
<url>
<loc>http://the-frenemy.local</loc>
<lastmod>2021-04-16T00:00:00+00:00</lastmod>
<changefreq>daily</changefreq>
<priority>0.9</priority>
</url>
One more change set priority is 1 only home page.. all other pages set 0.9
Upvotes: 0
Views: 1598
Reputation: 260
Publish resource views
Then edit file: https://github1s.com/spatie/laravel-sitemap/blob/HEAD/resources/views/url.blade.php
<url>
@if (! empty($tag->url))
<loc>{{ url($tag->url) }}</loc>
@endif
@if (count($tag->alternates))
@foreach ($tag->alternates as $alternate)
<xhtml:link rel="alternate" hreflang="{{ $alternate->locale }}" href="{{ url($alternate->url) }}" />
@endforeach
@endif
@if (! empty($tag->lastModificationDate))
<lastmod>{{ $tag->lastModificationDate->format(DateTime::ATOM) }}</lastmod>
@endif
// remove this
@if (! empty($tag->changeFrequency))
<changefreq>{{ $tag->changeFrequency }}</changefreq>
@endif
// remove this
@if (! empty($tag->priority))
<priority>{{ number_format($tag->priority,1) }}</priority>
@endif
</url>
Upvotes: 1