File tree Expand file tree Collapse file tree 1 file changed +15
-19
lines changed
Expand file tree Collapse file tree 1 file changed +15
-19
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,23 @@ class Sitemap
1616
1717 public static function pages ()
1818 {
19- return (new static )->getPages ();
19+ $ sitemap = new static ;
20+
21+ return collect ()
22+ ->merge ($ sitemap ->getPages ($ sitemap ->publishedEntries ()))
23+ ->merge ($ sitemap ->getPages ($ sitemap ->publishedTerms ()))
24+ ->merge ($ sitemap ->getPages ($ sitemap ->publishedCollectionTerms ()))
25+ ->sortBy (function ($ page ) {
26+ return substr_count (rtrim ($ page ->path (), '/ ' ), '/ ' );
27+ })
28+ ->values ()
29+ ->map
30+ ->toArray ();
2031 }
2132
22- public function getPages ()
33+ protected function getPages ($ items )
2334 {
24- return $ this -> publishedContent ()
35+ return $ items
2536 ->map (function ($ content ) {
2637 $ cascade = $ content ->value ('seo ' );
2738
@@ -38,22 +49,7 @@ public function getPages()
3849
3950 return (new Page )->with ($ data );
4051 })
41- ->filter ()
42- ->sortBy (function ($ page ) {
43- return substr_count (rtrim ($ page ->path (), '/ ' ), '/ ' );
44- })
45- ->values ()
46- ->map
47- ->toArray ();
48- }
49-
50- protected function publishedContent ()
51- {
52- return collect ()
53- ->merge ($ this ->publishedEntries ())
54- ->merge ($ this ->publishedTerms ())
55- ->merge ($ this ->publishedCollectionTerms ())
56- ->values ();
52+ ->filter ();
5753 }
5854
5955 protected function publishedEntries ()
You can’t perform that action at this time.
0 commit comments