public function sitemap() { /* * Main public sections. * * Do not include authentication, admin, payment callbacks, * checkout URLs, downloads or other private/action URLs. */ $urls = collect([ [ 'loc' => route('website.home'), 'lastmod' => null, ], [ 'loc' => route('careers.index'), 'lastmod' => null, ], [ 'loc' => route('founders.index'), 'lastmod' => null, ], [ 'loc' => route('events.index'), 'lastmod' => null, ], [ 'loc' => route('ranking.index'), 'lastmod' => null, ], [ 'loc' => route('subscriptions.index'), 'lastmod' => null, ], [ 'loc' => route('partnerships.index'), 'lastmod' => null, ], [ 'loc' => route('business-registrations.index'), 'lastmod' => null, ], [ 'loc' => route('magazines.index'), 'lastmod' => null, ], [ 'loc' => route('helpdesk.index'), 'lastmod' => null, ], [ 'loc' => route('website.blog.index'), 'lastmod' => null, ], ]); /* * CMS pages and blog posts. * * Use the same publication-window rules used elsewhere * in PublicWebsiteController. */ $pages = WebsitePage::query() ->where('status', 'published') ->where('visibility', 'public') ->where('is_indexable', true) ->where(function ($query) { $query->whereNull('scheduled_at') ->orWhere('scheduled_at', '<=', now()); }) ->where(function ($query) { $query->whereNull('unpublish_at') ->orWhere('unpublish_at', '>', now()); }) ->get(); foreach ($pages as $page) { if ($page->slug === 'home') { $loc = route('website.home'); } elseif ($page->content_type === 'blog') { $loc = route('website.blog.show', $page); } else { $loc = route('website.pages.show', $page); } $urls->push([ 'loc' => $loc, 'lastmod' => $page->updated_at?->toAtomString(), ]); } /* * Published events. */ Event::query() ->where('status', 'published') ->get() ->each(function (Event $event) use ($urls) { $urls->push([ 'loc' => route('events.show', $event), 'lastmod' => $event->updated_at?->toAtomString(), ]); }); /* * Published trade tours. */ EventTour::query() ->where('status', 'published') ->get() ->each(function (EventTour $tour) use ($urls) { $urls->push([ 'loc' => route('events.tours.show', $tour), 'lastmod' => $tour->updated_at?->toAtomString(), ]); }); /* * Published ranking companies. */ RankingCompany::query() ->where('status', 'published') ->get() ->each(function (RankingCompany $company) use ($urls) { $urls->push([ 'loc' => route('ranking.companies.show', $company), 'lastmod' => $company->updated_at?->toAtomString(), ]); }); /* * Published magazines. */ Magazine::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Magazine $magazine) use ($urls) { $urls->push([ 'loc' => route('magazines.show', $magazine), 'lastmod' => $magazine->updated_at?->toAtomString(), ]); }); /* * Published partners. */ Partner::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Partner $partner) use ($urls) { $urls->push([ 'loc' => route('partnerships.show', $partner), 'lastmod' => $partner->updated_at?->toAtomString(), ]); }); /* * Current open careers. */ HrJobRequisition::query() ->where('status', 'open') ->where(function ($query) { $query->whereNull('opens_at') ->orWhere('opens_at', '<=', today()); }) ->where(function ($query) { $query->whereNull('closes_at') ->orWhere('closes_at', '>=', today()); }) ->get() ->each(function (HrJobRequisition $job) use ($urls) { $urls->push([ 'loc' => route('careers.show', $job), 'lastmod' => $job->updated_at?->toAtomString(), ]); }); /* * Public helpdesk/knowledge-base articles. */ HelpdeskArticle::query() ->where('status', 'published') ->where('audience', 'public') ->get() ->each(function (HelpdeskArticle $article) use ($urls) { $urls->push([ 'loc' => route('helpdesk.articles.show', $article), 'lastmod' => $article->updated_at?->toAtomString(), ]); }); /* * Remove duplicate URLs, especially the homepage, and sort * the final sitemap for predictable output. */ $urls = $urls ->unique('loc') ->sortBy('loc') ->values(); return response() ->view('website.sitemap', compact('urls')) ->header('Content-Type', 'application/xml; charset=UTF-8'); }public function sitemap() { /* * Main public sections. * * Do not include authentication, admin, payment callbacks, * checkout URLs, downloads or other private/action URLs. */ $urls = collect([ [ 'loc' => route('website.home'), 'lastmod' => null, ], [ 'loc' => route('careers.index'), 'lastmod' => null, ], [ 'loc' => route('founders.index'), 'lastmod' => null, ], [ 'loc' => route('events.index'), 'lastmod' => null, ], [ 'loc' => route('ranking.index'), 'lastmod' => null, ], [ 'loc' => route('subscriptions.index'), 'lastmod' => null, ], [ 'loc' => route('partnerships.index'), 'lastmod' => null, ], [ 'loc' => route('business-registrations.index'), 'lastmod' => null, ], [ 'loc' => route('magazines.index'), 'lastmod' => null, ], [ 'loc' => route('helpdesk.index'), 'lastmod' => null, ], [ 'loc' => route('website.blog.index'), 'lastmod' => null, ], ]); /* * CMS pages and blog posts. * * Use the same publication-window rules used elsewhere * in PublicWebsiteController. */ $pages = WebsitePage::query() ->where('status', 'published') ->where('visibility', 'public') ->where('is_indexable', true) ->where(function ($query) { $query->whereNull('scheduled_at') ->orWhere('scheduled_at', '<=', now()); }) ->where(function ($query) { $query->whereNull('unpublish_at') ->orWhere('unpublish_at', '>', now()); }) ->get(); foreach ($pages as $page) { if ($page->slug === 'home') { $loc = route('website.home'); } elseif ($page->content_type === 'blog') { $loc = route('website.blog.show', $page); } else { $loc = route('website.pages.show', $page); } $urls->push([ 'loc' => $loc, 'lastmod' => $page->updated_at?->toAtomString(), ]); } /* * Published events. */ Event::query() ->where('status', 'published') ->get() ->each(function (Event $event) use ($urls) { $urls->push([ 'loc' => route('events.show', $event), 'lastmod' => $event->updated_at?->toAtomString(), ]); }); /* * Published trade tours. */ EventTour::query() ->where('status', 'published') ->get() ->each(function (EventTour $tour) use ($urls) { $urls->push([ 'loc' => route('events.tours.show', $tour), 'lastmod' => $tour->updated_at?->toAtomString(), ]); }); /* * Published ranking companies. */ RankingCompany::query() ->where('status', 'published') ->get() ->each(function (RankingCompany $company) use ($urls) { $urls->push([ 'loc' => route('ranking.companies.show', $company), 'lastmod' => $company->updated_at?->toAtomString(), ]); }); /* * Published magazines. */ Magazine::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Magazine $magazine) use ($urls) { $urls->push([ 'loc' => route('magazines.show', $magazine), 'lastmod' => $magazine->updated_at?->toAtomString(), ]); }); /* * Published partners. */ Partner::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Partner $partner) use ($urls) { $urls->push([ 'loc' => route('partnerships.show', $partner), 'lastmod' => $partner->updated_at?->toAtomString(), ]); }); /* * Current open careers. */ HrJobRequisition::query() ->where('status', 'open') ->where(function ($query) { $query->whereNull('opens_at') ->orWhere('opens_at', '<=', today()); }) ->where(function ($query) { $query->whereNull('closes_at') ->orWhere('closes_at', '>=', today()); }) ->get() ->each(function (HrJobRequisition $job) use ($urls) { $urls->push([ 'loc' => route('careers.show', $job), 'lastmod' => $job->updated_at?->toAtomString(), ]); }); /* * Public helpdesk/knowledge-base articles. */ HelpdeskArticle::query() ->where('status', 'published') ->where('audience', 'public') ->get() ->each(function (HelpdeskArticle $article) use ($urls) { $urls->push([ 'loc' => route('helpdesk.articles.show', $article), 'lastmod' => $article->updated_at?->toAtomString(), ]); }); /* * Remove duplicate URLs, especially the homepage, and sort * the final sitemap for predictable output. */ $urls = $urls ->unique('loc') ->sortBy('loc') ->values(); return response() ->view('website.sitemap', compact('urls')) ->header('Content-Type', 'application/xml; charset=UTF-8'); }public function sitemap() { /* * Main public sections. * * Do not include authentication, admin, payment callbacks, * checkout URLs, downloads or other private/action URLs. */ $urls = collect([ [ 'loc' => route('website.home'), 'lastmod' => null, ], [ 'loc' => route('careers.index'), 'lastmod' => null, ], [ 'loc' => route('founders.index'), 'lastmod' => null, ], [ 'loc' => route('events.index'), 'lastmod' => null, ], [ 'loc' => route('ranking.index'), 'lastmod' => null, ], [ 'loc' => route('subscriptions.index'), 'lastmod' => null, ], [ 'loc' => route('partnerships.index'), 'lastmod' => null, ], [ 'loc' => route('business-registrations.index'), 'lastmod' => null, ], [ 'loc' => route('magazines.index'), 'lastmod' => null, ], [ 'loc' => route('helpdesk.index'), 'lastmod' => null, ], [ 'loc' => route('website.blog.index'), 'lastmod' => null, ], ]); /* * CMS pages and blog posts. * * Use the same publication-window rules used elsewhere * in PublicWebsiteController. */ $pages = WebsitePage::query() ->where('status', 'published') ->where('visibility', 'public') ->where('is_indexable', true) ->where(function ($query) { $query->whereNull('scheduled_at') ->orWhere('scheduled_at', '<=', now()); }) ->where(function ($query) { $query->whereNull('unpublish_at') ->orWhere('unpublish_at', '>', now()); }) ->get(); foreach ($pages as $page) { if ($page->slug === 'home') { $loc = route('website.home'); } elseif ($page->content_type === 'blog') { $loc = route('website.blog.show', $page); } else { $loc = route('website.pages.show', $page); } $urls->push([ 'loc' => $loc, 'lastmod' => $page->updated_at?->toAtomString(), ]); } /* * Published events. */ Event::query() ->where('status', 'published') ->get() ->each(function (Event $event) use ($urls) { $urls->push([ 'loc' => route('events.show', $event), 'lastmod' => $event->updated_at?->toAtomString(), ]); }); /* * Published trade tours. */ EventTour::query() ->where('status', 'published') ->get() ->each(function (EventTour $tour) use ($urls) { $urls->push([ 'loc' => route('events.tours.show', $tour), 'lastmod' => $tour->updated_at?->toAtomString(), ]); }); /* * Published ranking companies. */ RankingCompany::query() ->where('status', 'published') ->get() ->each(function (RankingCompany $company) use ($urls) { $urls->push([ 'loc' => route('ranking.companies.show', $company), 'lastmod' => $company->updated_at?->toAtomString(), ]); }); /* * Published magazines. */ Magazine::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Magazine $magazine) use ($urls) { $urls->push([ 'loc' => route('magazines.show', $magazine), 'lastmod' => $magazine->updated_at?->toAtomString(), ]); }); /* * Published partners. */ Partner::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Partner $partner) use ($urls) { $urls->push([ 'loc' => route('partnerships.show', $partner), 'lastmod' => $partner->updated_at?->toAtomString(), ]); }); /* * Current open careers. */ HrJobRequisition::query() ->where('status', 'open') ->where(function ($query) { $query->whereNull('opens_at') ->orWhere('opens_at', '<=', today()); }) ->where(function ($query) { $query->whereNull('closes_at') ->orWhere('closes_at', '>=', today()); }) ->get() ->each(function (HrJobRequisition $job) use ($urls) { $urls->push([ 'loc' => route('careers.show', $job), 'lastmod' => $job->updated_at?->toAtomString(), ]); }); /* * Public helpdesk/knowledge-base articles. */ HelpdeskArticle::query() ->where('status', 'published') ->where('audience', 'public') ->get() ->each(function (HelpdeskArticle $article) use ($urls) { $urls->push([ 'loc' => route('helpdesk.articles.show', $article), 'lastmod' => $article->updated_at?->toAtomString(), ]); }); /* * Remove duplicate URLs, especially the homepage, and sort * the final sitemap for predictable output. */ $urls = $urls ->unique('loc') ->sortBy('loc') ->values(); return response() ->view('website.sitemap', compact('urls')) ->header('Content-Type', 'application/xml; charset=UTF-8'); }public function sitemap() { /* * Main public sections. * * Do not include authentication, admin, payment callbacks, * checkout URLs, downloads or other private/action URLs. */ $urls = collect([ [ 'loc' => route('website.home'), 'lastmod' => null, ], [ 'loc' => route('careers.index'), 'lastmod' => null, ], [ 'loc' => route('founders.index'), 'lastmod' => null, ], [ 'loc' => route('events.index'), 'lastmod' => null, ], [ 'loc' => route('ranking.index'), 'lastmod' => null, ], [ 'loc' => route('subscriptions.index'), 'lastmod' => null, ], [ 'loc' => route('partnerships.index'), 'lastmod' => null, ], [ 'loc' => route('business-registrations.index'), 'lastmod' => null, ], [ 'loc' => route('magazines.index'), 'lastmod' => null, ], [ 'loc' => route('helpdesk.index'), 'lastmod' => null, ], [ 'loc' => route('website.blog.index'), 'lastmod' => null, ], ]); /* * CMS pages and blog posts. * * Use the same publication-window rules used elsewhere * in PublicWebsiteController. */ $pages = WebsitePage::query() ->where('status', 'published') ->where('visibility', 'public') ->where('is_indexable', true) ->where(function ($query) { $query->whereNull('scheduled_at') ->orWhere('scheduled_at', '<=', now()); }) ->where(function ($query) { $query->whereNull('unpublish_at') ->orWhere('unpublish_at', '>', now()); }) ->get(); foreach ($pages as $page) { if ($page->slug === 'home') { $loc = route('website.home'); } elseif ($page->content_type === 'blog') { $loc = route('website.blog.show', $page); } else { $loc = route('website.pages.show', $page); } $urls->push([ 'loc' => $loc, 'lastmod' => $page->updated_at?->toAtomString(), ]); } /* * Published events. */ Event::query() ->where('status', 'published') ->get() ->each(function (Event $event) use ($urls) { $urls->push([ 'loc' => route('events.show', $event), 'lastmod' => $event->updated_at?->toAtomString(), ]); }); /* * Published trade tours. */ EventTour::query() ->where('status', 'published') ->get() ->each(function (EventTour $tour) use ($urls) { $urls->push([ 'loc' => route('events.tours.show', $tour), 'lastmod' => $tour->updated_at?->toAtomString(), ]); }); /* * Published ranking companies. */ RankingCompany::query() ->where('status', 'published') ->get() ->each(function (RankingCompany $company) use ($urls) { $urls->push([ 'loc' => route('ranking.companies.show', $company), 'lastmod' => $company->updated_at?->toAtomString(), ]); }); /* * Published magazines. */ Magazine::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Magazine $magazine) use ($urls) { $urls->push([ 'loc' => route('magazines.show', $magazine), 'lastmod' => $magazine->updated_at?->toAtomString(), ]); }); /* * Published partners. */ Partner::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Partner $partner) use ($urls) { $urls->push([ 'loc' => route('partnerships.show', $partner), 'lastmod' => $partner->updated_at?->toAtomString(), ]); }); /* * Current open careers. */ HrJobRequisition::query() ->where('status', 'open') ->where(function ($query) { $query->whereNull('opens_at') ->orWhere('opens_at', '<=', today()); }) ->where(function ($query) { $query->whereNull('closes_at') ->orWhere('closes_at', '>=', today()); }) ->get() ->each(function (HrJobRequisition $job) use ($urls) { $urls->push([ 'loc' => route('careers.show', $job), 'lastmod' => $job->updated_at?->toAtomString(), ]); }); /* * Public helpdesk/knowledge-base articles. */ HelpdeskArticle::query() ->where('status', 'published') ->where('audience', 'public') ->get() ->each(function (HelpdeskArticle $article) use ($urls) { $urls->push([ 'loc' => route('helpdesk.articles.show', $article), 'lastmod' => $article->updated_at?->toAtomString(), ]); }); /* * Remove duplicate URLs, especially the homepage, and sort * the final sitemap for predictable output. */ $urls = $urls ->unique('loc') ->sortBy('loc') ->values(); return response() ->view('website.sitemap', compact('urls')) ->header('Content-Type', 'application/xml; charset=UTF-8'); }public function sitemap() { /* * Main public sections. * * Do not include authentication, admin, payment callbacks, * checkout URLs, downloads or other private/action URLs. */ $urls = collect([ [ 'loc' => route('website.home'), 'lastmod' => null, ], [ 'loc' => route('careers.index'), 'lastmod' => null, ], [ 'loc' => route('founders.index'), 'lastmod' => null, ], [ 'loc' => route('events.index'), 'lastmod' => null, ], [ 'loc' => route('ranking.index'), 'lastmod' => null, ], [ 'loc' => route('subscriptions.index'), 'lastmod' => null, ], [ 'loc' => route('partnerships.index'), 'lastmod' => null, ], [ 'loc' => route('business-registrations.index'), 'lastmod' => null, ], [ 'loc' => route('magazines.index'), 'lastmod' => null, ], [ 'loc' => route('helpdesk.index'), 'lastmod' => null, ], [ 'loc' => route('website.blog.index'), 'lastmod' => null, ], ]); /* * CMS pages and blog posts. * * Use the same publication-window rules used elsewhere * in PublicWebsiteController. */ $pages = WebsitePage::query() ->where('status', 'published') ->where('visibility', 'public') ->where('is_indexable', true) ->where(function ($query) { $query->whereNull('scheduled_at') ->orWhere('scheduled_at', '<=', now()); }) ->where(function ($query) { $query->whereNull('unpublish_at') ->orWhere('unpublish_at', '>', now()); }) ->get(); foreach ($pages as $page) { if ($page->slug === 'home') { $loc = route('website.home'); } elseif ($page->content_type === 'blog') { $loc = route('website.blog.show', $page); } else { $loc = route('website.pages.show', $page); } $urls->push([ 'loc' => $loc, 'lastmod' => $page->updated_at?->toAtomString(), ]); } /* * Published events. */ Event::query() ->where('status', 'published') ->get() ->each(function (Event $event) use ($urls) { $urls->push([ 'loc' => route('events.show', $event), 'lastmod' => $event->updated_at?->toAtomString(), ]); }); /* * Published trade tours. */ EventTour::query() ->where('status', 'published') ->get() ->each(function (EventTour $tour) use ($urls) { $urls->push([ 'loc' => route('events.tours.show', $tour), 'lastmod' => $tour->updated_at?->toAtomString(), ]); }); /* * Published ranking companies. */ RankingCompany::query() ->where('status', 'published') ->get() ->each(function (RankingCompany $company) use ($urls) { $urls->push([ 'loc' => route('ranking.companies.show', $company), 'lastmod' => $company->updated_at?->toAtomString(), ]); }); /* * Published magazines. */ Magazine::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Magazine $magazine) use ($urls) { $urls->push([ 'loc' => route('magazines.show', $magazine), 'lastmod' => $magazine->updated_at?->toAtomString(), ]); }); /* * Published partners. */ Partner::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Partner $partner) use ($urls) { $urls->push([ 'loc' => route('partnerships.show', $partner), 'lastmod' => $partner->updated_at?->toAtomString(), ]); }); /* * Current open careers. */ HrJobRequisition::query() ->where('status', 'open') ->where(function ($query) { $query->whereNull('opens_at') ->orWhere('opens_at', '<=', today()); }) ->where(function ($query) { $query->whereNull('closes_at') ->orWhere('closes_at', '>=', today()); }) ->get() ->each(function (HrJobRequisition $job) use ($urls) { $urls->push([ 'loc' => route('careers.show', $job), 'lastmod' => $job->updated_at?->toAtomString(), ]); }); /* * Public helpdesk/knowledge-base articles. */ HelpdeskArticle::query() ->where('status', 'published') ->where('audience', 'public') ->get() ->each(function (HelpdeskArticle $article) use ($urls) { $urls->push([ 'loc' => route('helpdesk.articles.show', $article), 'lastmod' => $article->updated_at?->toAtomString(), ]); }); /* * Remove duplicate URLs, especially the homepage, and sort * the final sitemap for predictable output. */ $urls = $urls ->unique('loc') ->sortBy('loc') ->values(); return response() ->view('website.sitemap', compact('urls')) ->header('Content-Type', 'application/xml; charset=UTF-8'); }public function sitemap() { /* * Main public sections. * * Do not include authentication, admin, payment callbacks, * checkout URLs, downloads or other private/action URLs. */ $urls = collect([ [ 'loc' => route('website.home'), 'lastmod' => null, ], [ 'loc' => route('careers.index'), 'lastmod' => null, ], [ 'loc' => route('founders.index'), 'lastmod' => null, ], [ 'loc' => route('events.index'), 'lastmod' => null, ], [ 'loc' => route('ranking.index'), 'lastmod' => null, ], [ 'loc' => route('subscriptions.index'), 'lastmod' => null, ], [ 'loc' => route('partnerships.index'), 'lastmod' => null, ], [ 'loc' => route('business-registrations.index'), 'lastmod' => null, ], [ 'loc' => route('magazines.index'), 'lastmod' => null, ], [ 'loc' => route('helpdesk.index'), 'lastmod' => null, ], [ 'loc' => route('website.blog.index'), 'lastmod' => null, ], ]); /* * CMS pages and blog posts. * * Use the same publication-window rules used elsewhere * in PublicWebsiteController. */ $pages = WebsitePage::query() ->where('status', 'published') ->where('visibility', 'public') ->where('is_indexable', true) ->where(function ($query) { $query->whereNull('scheduled_at') ->orWhere('scheduled_at', '<=', now()); }) ->where(function ($query) { $query->whereNull('unpublish_at') ->orWhere('unpublish_at', '>', now()); }) ->get(); foreach ($pages as $page) { if ($page->slug === 'home') { $loc = route('website.home'); } elseif ($page->content_type === 'blog') { $loc = route('website.blog.show', $page); } else { $loc = route('website.pages.show', $page); } $urls->push([ 'loc' => $loc, 'lastmod' => $page->updated_at?->toAtomString(), ]); } /* * Published events. */ Event::query() ->where('status', 'published') ->get() ->each(function (Event $event) use ($urls) { $urls->push([ 'loc' => route('events.show', $event), 'lastmod' => $event->updated_at?->toAtomString(), ]); }); /* * Published trade tours. */ EventTour::query() ->where('status', 'published') ->get() ->each(function (EventTour $tour) use ($urls) { $urls->push([ 'loc' => route('events.tours.show', $tour), 'lastmod' => $tour->updated_at?->toAtomString(), ]); }); /* * Published ranking companies. */ RankingCompany::query() ->where('status', 'published') ->get() ->each(function (RankingCompany $company) use ($urls) { $urls->push([ 'loc' => route('ranking.companies.show', $company), 'lastmod' => $company->updated_at?->toAtomString(), ]); }); /* * Published magazines. */ Magazine::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Magazine $magazine) use ($urls) { $urls->push([ 'loc' => route('magazines.show', $magazine), 'lastmod' => $magazine->updated_at?->toAtomString(), ]); }); /* * Published partners. */ Partner::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Partner $partner) use ($urls) { $urls->push([ 'loc' => route('partnerships.show', $partner), 'lastmod' => $partner->updated_at?->toAtomString(), ]); }); /* * Current open careers. */ HrJobRequisition::query() ->where('status', 'open') ->where(function ($query) { $query->whereNull('opens_at') ->orWhere('opens_at', '<=', today()); }) ->where(function ($query) { $query->whereNull('closes_at') ->orWhere('closes_at', '>=', today()); }) ->get() ->each(function (HrJobRequisition $job) use ($urls) { $urls->push([ 'loc' => route('careers.show', $job), 'lastmod' => $job->updated_at?->toAtomString(), ]); }); /* * Public helpdesk/knowledge-base articles. */ HelpdeskArticle::query() ->where('status', 'published') ->where('audience', 'public') ->get() ->each(function (HelpdeskArticle $article) use ($urls) { $urls->push([ 'loc' => route('helpdesk.articles.show', $article), 'lastmod' => $article->updated_at?->toAtomString(), ]); }); /* * Remove duplicate URLs, especially the homepage, and sort * the final sitemap for predictable output. */ $urls = $urls ->unique('loc') ->sortBy('loc') ->values(); return response() ->view('website.sitemap', compact('urls')) ->header('Content-Type', 'application/xml; charset=UTF-8'); }public function sitemap() { /* * Main public sections. * * Do not include authentication, admin, payment callbacks, * checkout URLs, downloads or other private/action URLs. */ $urls = collect([ [ 'loc' => route('website.home'), 'lastmod' => null, ], [ 'loc' => route('careers.index'), 'lastmod' => null, ], [ 'loc' => route('founders.index'), 'lastmod' => null, ], [ 'loc' => route('events.index'), 'lastmod' => null, ], [ 'loc' => route('ranking.index'), 'lastmod' => null, ], [ 'loc' => route('subscriptions.index'), 'lastmod' => null, ], [ 'loc' => route('partnerships.index'), 'lastmod' => null, ], [ 'loc' => route('business-registrations.index'), 'lastmod' => null, ], [ 'loc' => route('magazines.index'), 'lastmod' => null, ], [ 'loc' => route('helpdesk.index'), 'lastmod' => null, ], [ 'loc' => route('website.blog.index'), 'lastmod' => null, ], ]); /* * CMS pages and blog posts. * * Use the same publication-window rules used elsewhere * in PublicWebsiteController. */ $pages = WebsitePage::query() ->where('status', 'published') ->where('visibility', 'public') ->where('is_indexable', true) ->where(function ($query) { $query->whereNull('scheduled_at') ->orWhere('scheduled_at', '<=', now()); }) ->where(function ($query) { $query->whereNull('unpublish_at') ->orWhere('unpublish_at', '>', now()); }) ->get(); foreach ($pages as $page) { if ($page->slug === 'home') { $loc = route('website.home'); } elseif ($page->content_type === 'blog') { $loc = route('website.blog.show', $page); } else { $loc = route('website.pages.show', $page); } $urls->push([ 'loc' => $loc, 'lastmod' => $page->updated_at?->toAtomString(), ]); } /* * Published events. */ Event::query() ->where('status', 'published') ->get() ->each(function (Event $event) use ($urls) { $urls->push([ 'loc' => route('events.show', $event), 'lastmod' => $event->updated_at?->toAtomString(), ]); }); /* * Published trade tours. */ EventTour::query() ->where('status', 'published') ->get() ->each(function (EventTour $tour) use ($urls) { $urls->push([ 'loc' => route('events.tours.show', $tour), 'lastmod' => $tour->updated_at?->toAtomString(), ]); }); /* * Published ranking companies. */ RankingCompany::query() ->where('status', 'published') ->get() ->each(function (RankingCompany $company) use ($urls) { $urls->push([ 'loc' => route('ranking.companies.show', $company), 'lastmod' => $company->updated_at?->toAtomString(), ]); }); /* * Published magazines. */ Magazine::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Magazine $magazine) use ($urls) { $urls->push([ 'loc' => route('magazines.show', $magazine), 'lastmod' => $magazine->updated_at?->toAtomString(), ]); }); /* * Published partners. */ Partner::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Partner $partner) use ($urls) { $urls->push([ 'loc' => route('partnerships.show', $partner), 'lastmod' => $partner->updated_at?->toAtomString(), ]); }); /* * Current open careers. */ HrJobRequisition::query() ->where('status', 'open') ->where(function ($query) { $query->whereNull('opens_at') ->orWhere('opens_at', '<=', today()); }) ->where(function ($query) { $query->whereNull('closes_at') ->orWhere('closes_at', '>=', today()); }) ->get() ->each(function (HrJobRequisition $job) use ($urls) { $urls->push([ 'loc' => route('careers.show', $job), 'lastmod' => $job->updated_at?->toAtomString(), ]); }); /* * Public helpdesk/knowledge-base articles. */ HelpdeskArticle::query() ->where('status', 'published') ->where('audience', 'public') ->get() ->each(function (HelpdeskArticle $article) use ($urls) { $urls->push([ 'loc' => route('helpdesk.articles.show', $article), 'lastmod' => $article->updated_at?->toAtomString(), ]); }); /* * Remove duplicate URLs, especially the homepage, and sort * the final sitemap for predictable output. */ $urls = $urls ->unique('loc') ->sortBy('loc') ->values(); return response() ->view('website.sitemap', compact('urls')) ->header('Content-Type', 'application/xml; charset=UTF-8'); }public function sitemap() { /* * Main public sections. * * Do not include authentication, admin, payment callbacks, * checkout URLs, downloads or other private/action URLs. */ $urls = collect([ [ 'loc' => route('website.home'), 'lastmod' => null, ], [ 'loc' => route('careers.index'), 'lastmod' => null, ], [ 'loc' => route('founders.index'), 'lastmod' => null, ], [ 'loc' => route('events.index'), 'lastmod' => null, ], [ 'loc' => route('ranking.index'), 'lastmod' => null, ], [ 'loc' => route('subscriptions.index'), 'lastmod' => null, ], [ 'loc' => route('partnerships.index'), 'lastmod' => null, ], [ 'loc' => route('business-registrations.index'), 'lastmod' => null, ], [ 'loc' => route('magazines.index'), 'lastmod' => null, ], [ 'loc' => route('helpdesk.index'), 'lastmod' => null, ], [ 'loc' => route('website.blog.index'), 'lastmod' => null, ], ]); /* * CMS pages and blog posts. * * Use the same publication-window rules used elsewhere * in PublicWebsiteController. */ $pages = WebsitePage::query() ->where('status', 'published') ->where('visibility', 'public') ->where('is_indexable', true) ->where(function ($query) { $query->whereNull('scheduled_at') ->orWhere('scheduled_at', '<=', now()); }) ->where(function ($query) { $query->whereNull('unpublish_at') ->orWhere('unpublish_at', '>', now()); }) ->get(); foreach ($pages as $page) { if ($page->slug === 'home') { $loc = route('website.home'); } elseif ($page->content_type === 'blog') { $loc = route('website.blog.show', $page); } else { $loc = route('website.pages.show', $page); } $urls->push([ 'loc' => $loc, 'lastmod' => $page->updated_at?->toAtomString(), ]); } /* * Published events. */ Event::query() ->where('status', 'published') ->get() ->each(function (Event $event) use ($urls) { $urls->push([ 'loc' => route('events.show', $event), 'lastmod' => $event->updated_at?->toAtomString(), ]); }); /* * Published trade tours. */ EventTour::query() ->where('status', 'published') ->get() ->each(function (EventTour $tour) use ($urls) { $urls->push([ 'loc' => route('events.tours.show', $tour), 'lastmod' => $tour->updated_at?->toAtomString(), ]); }); /* * Published ranking companies. */ RankingCompany::query() ->where('status', 'published') ->get() ->each(function (RankingCompany $company) use ($urls) { $urls->push([ 'loc' => route('ranking.companies.show', $company), 'lastmod' => $company->updated_at?->toAtomString(), ]); }); /* * Published magazines. */ Magazine::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Magazine $magazine) use ($urls) { $urls->push([ 'loc' => route('magazines.show', $magazine), 'lastmod' => $magazine->updated_at?->toAtomString(), ]); }); /* * Published partners. */ Partner::query() ->where('status', 'published') ->whereNotNull('published_at') ->get() ->each(function (Partner $partner) use ($urls) { $urls->push([ 'loc' => route('partnerships.show', $partner), 'lastmod' => $partner->updated_at?->toAtomString(), ]); }); /* * Current open careers. */ HrJobRequisition::query() ->where('status', 'open') ->where(function ($query) { $query->whereNull('opens_at') ->orWhere('opens_at', '<=', today()); }) ->where(function ($query) { $query->whereNull('closes_at') ->orWhere('closes_at', '>=', today()); }) ->get() ->each(function (HrJobRequisition $job) use ($urls) { $urls->push([ 'loc' => route('careers.show', $job), 'lastmod' => $job->updated_at?->toAtomString(), ]); }); /* * Public helpdesk/knowledge-base articles. */ HelpdeskArticle::query() ->where('status', 'published') ->where('audience', 'public') ->get() ->each(function (HelpdeskArticle $article) use ($urls) { $urls->push([ 'loc' => route('helpdesk.articles.show', $article), 'lastmod' => $article->updated_at?->toAtomString(), ]); }); /* * Remove duplicate URLs, especially the homepage, and sort * the final sitemap for predictable output. */ $urls = $urls ->unique('loc') ->sortBy('loc') ->values(); return response() ->view('website.sitemap', compact('urls')) ->header('Content-Type', 'application/xml; charset=UTF-8'); }