Theme-System mit Basis-Theme Ostsee-Licht, Bausteinen und saisonalen Erscheinungsbildern
- Sites (Domain, Theme, Farben; mehrfähig für weitere Vermieter), Seiten aus Bausteinen mit Menüs, Erscheinungsbilder mit jährlichem Zeitplan, Priorität und signierter Vorschau - Theme-Kern (app/Themes): Manifest, Registry, Vererbung (Child-Themes), Token-Farben als CSS-Variablen, Bausteinkatalog als Registry (config/themes.php) - 15 Bausteine: Titelbereich mit Suche, Eckdaten, Text mit Bildern, Galerie, Ausstattung, Lage, Preise, Angebote, Kalender & Anfrage, Bewertungen, Gastgeber, FAQ, Abschluss, Kontakt, Fließtext - Theme Ostsee-Licht: Layout, Kopf/Fuß, Banner, mobile Buchungsleiste, Lightbox, selbst gehostete Schriften, Reduced Motion - Seiten Start, Wohnung, Kühlungsborn, Preise & Buchung, Kontakt, Impressum, Datenschutz; Sitemap, robots.txt, JSON-LD - Admin: Seiten-Baukasten, Erscheinungsbilder, Websites - Dokumentation docs/THEMES.md inkl. Übergabe für die Design-Sitzung Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f2c48013ad
commit
66e82d61f5
119 files changed
+4066
-481
No files matched your search
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Page;
|
||||
use App\Support\Content;
|
||||
use App\Themes\SectionRegistry;
|
||||
use App\Themes\Theme;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
/**
|
||||
* Renders the website pages of the current site with the active theme.
|
||||
*/
|
||||
class PageController extends Controller
|
||||
{
|
||||
public function __construct(private SectionRegistry $sections) {}
|
||||
|
||||
/**
|
||||
* Resolved per call: the controller is built before the middleware has determined site and appearance.
|
||||
*/
|
||||
private function theme(): Theme
|
||||
{
|
||||
return app(Theme::class);
|
||||
}
|
||||
|
||||
public function home(): View
|
||||
{
|
||||
return $this->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',
|
||||
'Sitemap: '.route('sitemap'),
|
||||
'',
|
||||
]), 200, ['Content-Type' => 'text/plain; charset=UTF-8']);
|
||||
}
|
||||
|
||||
/**
|
||||
* schema.org data of the property for search engines.
|
||||
*
|
||||
* @return array<string, mixed>|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'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user