84 lines
3.3 KiB
PHP
84 lines
3.3 KiB
PHP
@props([
|
|
'sTitle' => config('app.title').' - '.config('app.name'),
|
|
'sDesc' => config('app.desc'),
|
|
'sKeywords' => config('app.keywords'),
|
|
'sSlug' => '',
|
|
'sOgType' => 'website',
|
|
'sOgImg' => '/sites/'.config("app.site_code_short").'/siteimg.jpg',
|
|
'sRobots' => 'index, follow',
|
|
'bEditorialPreview' => false,
|
|
'seo' => [],
|
|
])
|
|
|
|
@php
|
|
$sTitle = $seo['title'] ?? $sTitle;
|
|
$sDesc = \App\Services\Seo::text($seo['description'] ?? $sDesc);
|
|
$sCanonical = $seo['canonical'] ?? \App\Services\Seo::url(request()->path());
|
|
$sRobots = $bEditorialPreview ? 'noindex, nofollow' : ($seo['robots'] ?? $sRobots);
|
|
$sOgType = $seo['type'] ?? $sOgType;
|
|
$sOgImg = str_starts_with($sOgImg ?? '', '/') ? \App\Services\Seo::url($sOgImg) : $sOgImg;
|
|
@endphp
|
|
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
|
<meta name="slug" content="{{ $sSlug }}">
|
|
<meta name="robots" content="{{ !app()->environment(['production','testing']) ? 'noindex, nofollow' : $sRobots }}">
|
|
|
|
|
|
|
|
{{-- SEO 三杰 --}}
|
|
<title>{{ $sTitle }}</title>
|
|
<meta name="description" content="{{ $sDesc }}">
|
|
<meta name="keywords" content="{{ $sKeywords }}">
|
|
<link rel="canonical" href="{{ $sCanonical }}">
|
|
|
|
{{-- 社交媒体 Meta (Open Graph) - 现在的标准配置 --}}
|
|
<meta property="og:title" content="{{ $sTitle }}">
|
|
<meta property="og:description" content="{{ $sDesc }}">
|
|
<meta property="og:type" content="{{ $sOgType }}">
|
|
<meta property="og:url" content="{{ $sCanonical }}">
|
|
<meta property="og:image" content="{{ str_starts_with($sOgImg ?? '', '/') ? url($sOgImg) : $sOgImg }}">
|
|
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<meta name="twitter:title" content="{{ $sTitle }}">
|
|
<meta name="twitter:description" content="{{ $sDesc }}">
|
|
<meta name="twitter:image" content="{{ $sOgImg }}">
|
|
@unless($bEditorialPreview)
|
|
@foreach($seo['schema'] ?? [] as $schema)
|
|
<script type="application/ld+json">{!! json_encode($schema, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT) !!}</script>
|
|
@endforeach
|
|
@endunless
|
|
<link rel="stylesheet" href="/css/seo.css">
|
|
|
|
{{-- 声明它是 PNG,并告诉浏览器它的实际尺寸 --}}
|
|
<link rel="icon" type="image/png" href="/sites/{{ config('app.site_code_short') }}/icon.png" sizes="166x166">
|
|
|
|
{{-- 强行喂给苹果,虽然它推荐 180,但 166 总比没有强 --}}
|
|
<link rel="apple-touch-icon" href="/sites/{{ config('app.site_code_short') }}/icon.png">
|
|
|
|
{{-- 暂时没错颜色切换 --}}
|
|
<meta name="theme-color" content="#ffffff">
|
|
|
|
@vite(['resources/css/app.css', "resources/sites/".config("app.site_code_short")."/css/app.css",'resources/js/app.js'])
|
|
|
|
@stack('styles')
|
|
|
|
@if(app()->environment('production') && ! $bEditorialPreview && config('app.site_code_short') == 'cfn')
|
|
<script defer src="https://umami.gemcook.net/script.js" data-website-id="c553e118-942e-4d6b-9e6d-9d7e696ab5fd"></script>
|
|
@endif
|
|
|
|
</head>
|
|
<body class="home blog">
|
|
|
|
<x-nav-bar />
|
|
{{ $slot }}
|
|
<x-footer />
|
|
|
|
@stack('scripts')
|
|
</body>
|
|
</html>
|