Files
3dealer/resources/views/layouts/app.blade.php
elviraandClaude Opus 5.5 c1acc0067c Layout: Speculation Rules, prerender on hover
A <script type="speculationrules"> in the layout prerenders same-origin
links with eagerness "moderate" (hover or press). Excluded:
- cart, checkout, account, login, logout, wishlist, contact and the
  future /islands, plus the admin (/boboko) and /stoic
- rel~=nofollow and [data-no-prerender]
- listing controls that load into a Turbo Frame (sort, filters,
  pagination): links inside a <turbo-frame> or pointing at one, unless
  they break out with data-turbo-frame="_top" like the product cards

Contact is excluded too, though the task didn't list it: it's a session
page with hCaptcha.

GA4 and a consent banner aren't in this repo, so no page-view delay on
document.prerendering is needed yet. Add one when they're added.

Watch production FPM after this deploy: until pages are cached, every
prerender is a full PHP render, and there are only 8 FPM workers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 00:05:50 +02:00

117 lines
5.5 KiB
PHP

<!DOCTYPE html>
<html lang="{{ $currentLocale ?? app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta id="csrf-token" name="csrf-token" content="{{ csrf_token() }}">
{{-- Favicons --}}
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<meta name="apple-mobile-web-app-title" content="3dealer" />
<link rel="manifest" href="/site.webmanifest" />
<title>@yield('title', config('app.name'))</title>
{{-- Falls back to Stoic's default when a page sets none, or sets it to an
empty meta_description (@yield's own default only covers "not set"). --}}
<meta name="description" content="{{ trim($__env->yieldContent('description')) ?: $stoicSettings->get('meta_description', '') }}">
{{-- A page's own Stoic og_image (via @section('og_image')), else the default from settings.md. --}}
@if ($ogImage = $stoicSettings->ogImageUrl(trim($__env->yieldContent('og_image'))))
<meta property="og:image" content="{{ $ogImage }}">
@endif
{{-- Reciprocal hreflang: self-reference + every alternate locale + x-default --}}
@isset($currentLocale)
<link rel="alternate" hreflang="{{ $currentLocale }}" href="{{ url()->current() }}" />
@foreach ($altLocales ?? [] as $altLocale)
<link rel="alternate" hreflang="{{ $altLocale['code'] }}" href="{{ $altLocale['url'] }}" />
@endforeach
<link rel="alternate" hreflang="x-default" href="{{ url('/') }}" />
@endisset
@stack('seo')
{{-- Preload the Manrope weights used in above-the-fold text (body 400,
category <h1> 500, generic headings 700, nav 800) so the swap-in
doesn't reflow the header and headings on load — which otherwise
throws off scroll restoration on refresh. Same URLs as the @font-face
rules in fonts.css, so each is fetched once. --}}
<link rel="preload" as="font" type="font/woff2" crossorigin href="{{ \Illuminate\Support\Facades\Vite::asset('resources/fonts/manrope/manrope-v20-greek_latin-regular.woff2') }}">
<link rel="preload" as="font" type="font/woff2" crossorigin href="{{ \Illuminate\Support\Facades\Vite::asset('resources/fonts/manrope/manrope-v20-greek_latin-500.woff2') }}">
<link rel="preload" as="font" type="font/woff2" crossorigin href="{{ \Illuminate\Support\Facades\Vite::asset('resources/fonts/manrope/manrope-v20-greek_latin-700.woff2') }}">
<link rel="preload" as="font" type="font/woff2" crossorigin href="{{ \Illuminate\Support\Facades\Vite::asset('resources/fonts/manrope/manrope-v20-greek_latin-800.woff2') }}">
@vite(['node_modules/@boboko/core/resources/css/checkout.css', 'resources/css/app.css', 'resources/js/app.js'])
{{-- Speculation Rules: prerender same-origin pages on hover or press.
Excluded: personal/session pages (cart, checkout, account, login,
logout, wishlist, contact, the future /islands), the admin and Stoic,
rel=nofollow, anything marked data-no-prerender, and listing controls
(filters, sort, pagination) that load into a Turbo Frame instead of
navigating — i.e. links inside a <turbo-frame> or pointing at one,
unless they break out with data-turbo-frame="_top" (product cards). --}}
@verbatim
<script type="speculationrules">
{
"prerender": [{
"where": {
"and": [
{ "href_matches": "/*" },
{ "not": { "href_matches": [
"/:locale/cart{/*}?",
"/:locale/checkout{/*}?",
"/:locale/account{/*}?",
"/:locale/login{/*}?",
"/:locale/logout",
"/:locale/wishlist{/*}?",
"/:locale/contact{/*}?",
"/:locale/islands{/*}?",
"/islands{/*}?",
"/boboko{/*}?",
"/stoic{/*}?"
] } },
{ "not": { "selector_matches": "[rel~=nofollow], [data-no-prerender], turbo-frame a:not([data-turbo-frame=\"_top\"]), a[data-turbo-frame]:not([data-turbo-frame=\"_top\"])" } }
]
},
"eagerness": "moderate"
}]
}
</script>
@endverbatim
@auth('staff')
@php($stoicToken = \App\Services\Stoic::token(auth('staff')->user()->email))
<script>
window.STOIC_HOST = "{{ config('services.stoic.host') }}";
window.STOIC_SSO_TOKEN = "{!! $stoicToken !!}";
</script>
<script src="{{ asset('js/stoic_embed.js') }}"></script>
@endauth
@stack('head')
</head>
<body class="min-h-screen antialiased">
<x-header />
{{-- Not on the checkout page itself — its order-summary column already
plays the drawer's role there, and both reacting to the same
`bbk-cart:changed` event would pop the (redundant) drawer open over
the page every time a line's quantity changes in the summary. --}}
@unless (request()->routeIs('checkout.show'))
@include('checkout::drawer')
@endunless
<main id="main-content" class="min-h-[calc(100vh-12rem)] sm:min-h-[calc(100vh-8rem)]">
@yield('content')
</main>
<x-footer />
<x-back-to-top />
@stack('scripts')
</body>
</html>