Skip to content

Commit

Permalink
Fix sitemap.xml output
Browse files Browse the repository at this point in the history
  • Loading branch information
martink635 committed Nov 10, 2023
1 parent c3ac923 commit 95eaf0e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
23 changes: 12 additions & 11 deletions resources/views/sitemap.antlers.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
{{ header }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{{ entries }}
<url>
<loc>{{ loc }}</loc>
<lastmod>{{ lastmod }}</lastmod>
{{ alternates }}
<xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="{{lang}}" href="{{href}}" />
{{ /alternates }}
</url>
{{ /entries }}
</urlset>
{{ entries }}
<url>
<loc>{{ loc }}</loc>
<lastmod>{{ lastmod }}</lastmod>
{{ alternates }}
<xhtml:link xmlns:xhtml="http://www.w3.org/1999/xhtml" rel="alternate" hreflang="{{ lang }}"
href="{{ href }}" />
{{ /alternates }}
</url>
{{ /entries }}
</urlset>
2 changes: 1 addition & 1 deletion src/Http/Controllers/SitemapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function __invoke()

$content = Cache::remember('seotamic_sitemap', 1, function () use ($entries) {
return view('seotamic::sitemap', [
'header' => '<?xml version="1.0" encoding="UTF-8"?>',
'entries' => $entries,
])->render();
});
Expand All @@ -67,5 +68,4 @@ private static function shouldBeIndexed(Entry $entry): bool

return true;
}

}

0 comments on commit 95eaf0e

Please sign in to comment.