M2: 主题系统(sablog经典+modern简约)+ 前台全部页面 + 老 URL 301 兼容 + markdown 双份导入
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
@php
|
||||
$pageTitle = $post->title.' - '.$siteName;
|
||||
$pageDescription = Str::limit(strip_tags($post->excerpt_or_fallback), 150);
|
||||
$pageKeywords = $post->keywords ?: ($post->tags->pluck('name')->implode(','));
|
||||
@endphp
|
||||
@include('partials.head')
|
||||
<body>
|
||||
@include('partials.header')
|
||||
<div class="container main-layout">
|
||||
<main class="content">
|
||||
@if(session('success'))
|
||||
<div class="alert alert-success">{{ session('success') }}</div>
|
||||
@endif
|
||||
@if(session('error'))
|
||||
<div class="alert alert-error">{{ session('error') }}</div>
|
||||
@endif
|
||||
|
||||
<article class="post-full">
|
||||
@if($cover = $post->getFirstMedia('cover'))
|
||||
<div class="post-cover">
|
||||
<img src="{{ $cover->getUrl('card') ?: $cover->getUrl() }}" alt="{{ $post->title }}">
|
||||
</div>
|
||||
@endif
|
||||
<h1 class="post-title">{{ $post->title }}</h1>
|
||||
<div class="post-meta">
|
||||
<time datetime="{{ $post->published_at->toIso8601String() }}">{{ $post->published_at->format('Y-m-d H:i') }}</time>
|
||||
@if($post->author)<span>· {{ $post->author->name }}</span>@endif
|
||||
@if($post->category)
|
||||
<span>· <a href="{{ route('category.show', $post->category->slug ?: $post->category->id) }}">{{ $post->category->name }}</a></span>
|
||||
@endif
|
||||
<span>· 阅读 {{ $post->views }}</span>
|
||||
</div>
|
||||
|
||||
<div class="post-content">
|
||||
{!! $contentHtml !!}
|
||||
</div>
|
||||
|
||||
@if($post->tags->isNotEmpty())
|
||||
<div class="post-tags">
|
||||
@foreach($post->tags as $tag)
|
||||
<a href="{{ route('tags.show', $tag->slug ?: $tag->name) }}" class="tag-link">#{{ $tag->name }}</a>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</article>
|
||||
|
||||
@if(! $post->close_comment)
|
||||
<section id="comments" class="comments-section">
|
||||
<h2 class="section-title">评论 ({{ $comments->total() }})</h2>
|
||||
|
||||
@forelse($comments as $comment)
|
||||
<div class="comment" id="comment-{{ $comment->id }}">
|
||||
<div class="comment-head">
|
||||
<strong>{{ $comment->author_name }}</strong>
|
||||
@if($comment->author_url)
|
||||
<span>· <a href="{{ $comment->author_url }}" target="_blank" rel="noopener nofollow">访问主页</a></span>
|
||||
@endif
|
||||
<span class="comment-time">· {{ $comment->created_at->format('Y-m-d H:i') }}</span>
|
||||
</div>
|
||||
<div class="comment-body">{!! nl2br(e($comment->content)) !!}</div>
|
||||
</div>
|
||||
@empty
|
||||
<p class="empty">暂无评论</p>
|
||||
@endforelse
|
||||
|
||||
{{ $comments->links('partials.pagination-links') }}
|
||||
|
||||
<form method="post" action="{{ route('comments.store', $post) }}" class="comment-form" id="comment-form">
|
||||
@csrf
|
||||
<div class="form-row">
|
||||
@auth
|
||||
<input type="hidden" name="author_name" value="{{ auth()->user()->name }}">
|
||||
@else
|
||||
<input type="text" name="author_name" placeholder="昵称 *" required value="{{ old('author_name') }}">
|
||||
<input type="email" name="author_email" placeholder="邮箱(不公开)" value="{{ old('author_email') }}">
|
||||
<input type="url" name="author_url" placeholder="网站(可选)" value="{{ old('author_url') }}">
|
||||
@endauth
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<textarea name="content" rows="5" placeholder="写下你的评论..." required minlength="{{ blog_setting('comment_min_len', 2) }}">{{ old('content') }}</textarea>
|
||||
</div>
|
||||
{{-- 蜜罐字段:人类不会填写 --}}
|
||||
<div class="honeypot"><label>网站 <input type="text" name="website" tabindex="-1" autocomplete="off"></label></div>
|
||||
@error('content')<p class="error">{{ $message }}</p>@enderror
|
||||
@if($errors->has('author_name'))<p class="error">{{ $errors->first('author_name') }}</p>@endif
|
||||
<button type="submit" class="btn">发表评论</button>
|
||||
</form>
|
||||
</section>
|
||||
@endif
|
||||
</main>
|
||||
@include('partials.sidebar')
|
||||
</div>
|
||||
@include('partials.footer')
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user