show(Page::HOME); } public function show(string $slug): View { abort_unless($this->theme()->site->exists, 404); $page = $this->theme()->site->pages() ->where('slug', $slug) ->where('is_published', true) ->firstOrFail(); return view('theme::page', [ 'page' => $page, 'sections' => $this->sections->render($this->theme(), $page->sections), 'title' => $page->isHome() ? null : ($page->seo_title ?: $page->title), 'description' => $page->seo_description ?: ($page->isHome() ? Content::get('seo.home.description') : null), 'ogImage' => $this->theme()->heroPhoto()?->url('lg') ?: null, 'structuredData' => $page->isHome() ? $this->structuredData() : null, ]); } public function sitemap(): Response { $pages = $this->theme()->site->exists ? $this->theme()->site->pages()->where('is_published', true)->get() : collect(); return response()->view('sitemap', ['pages' => $pages], 200, ['Content-Type' => 'application/xml']); } public function robots(): Response { return response(implode("\n", [ 'User-agent: *', 'Disallow: /admin', 'Disallow: /livewire', 'Disallow: /automation', 'Disallow: /bewertung', 'Disallow: /angebote', 'Disallow: /angebot/', 'Sitemap: '.route('sitemap'), '', ]), 200, ['Content-Type' => 'text/plain; charset=UTF-8']); } /** * schema.org data of the property for search engines. * * @return array|null */ private function structuredData(): ?array { $property = $this->theme()->property(); if ($property === null) { return null; } return array_filter([ '@context' => 'https://schema.org', '@type' => 'VacationRental', 'name' => $property->name, 'url' => route('home'), 'image' => $this->theme()->heroPhoto()?->url('lg') ?: null, 'address' => ['@type' => 'PostalAddress', 'streetAddress' => str($property->address)->before(',')->trim()->toString(), 'addressLocality' => 'Kühlungsborn', 'postalCode' => '18225', 'addressCountry' => 'DE'], 'containsPlace' => ['@type' => 'Accommodation', 'floorSize' => ['@type' => 'QuantitativeValue', 'value' => $property->size_sqm, 'unitCode' => 'MTK'], 'occupancy' => ['@type' => 'QuantitativeValue', 'maxValue' => $property->max_guests]], 'telephone' => config('fewo.owner.phone'), ]); } }