|
|
|
@ -8,8 +8,14 @@ use App\Models\Table; |
|
|
|
|
use App\Models\User; |
|
|
|
|
use XMLWriter; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* This controller is responsible for producing a XML sitemap |
|
|
|
|
*/ |
|
|
|
|
class SitemapController extends Controller |
|
|
|
|
{ |
|
|
|
|
/** |
|
|
|
|
* Render a sitemap to the browser |
|
|
|
|
*/ |
|
|
|
|
public function sitemap() |
|
|
|
|
{ |
|
|
|
|
ob_end_clean(); |
|
|
|
@ -57,6 +63,12 @@ class SitemapController extends Controller |
|
|
|
|
$xmlWriter->endDocument(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Go through all tables and other links and return objects |
|
|
|
|
* that can be turned into sitemap entries. |
|
|
|
|
* |
|
|
|
|
* @return \Generator|object[] |
|
|
|
|
*/ |
|
|
|
|
private function iterateTables() |
|
|
|
|
{ |
|
|
|
|
$prio_info = .9; |
|
|
|
@ -100,6 +112,7 @@ class SitemapController extends Controller |
|
|
|
|
'priority' => $prio_misc, |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
// User profiles |
|
|
|
|
foreach (User::all() as $user) { |
|
|
|
|
yield (object)[ |
|
|
|
|
'url' => route('profile.view', $user->name), |
|
|
|
@ -108,6 +121,7 @@ class SitemapController extends Controller |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Tables |
|
|
|
|
foreach (Table::all() as $table) { |
|
|
|
|
yield (object)[ |
|
|
|
|
'url' => $table->viewRoute, |
|
|
|
|