M2: 主题系统(sablog经典+modern简约)+ 前台全部页面 + 老 URL 301 兼容 + markdown 双份导入
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
@php $pageTitle = '归档 - '.$siteName; @endphp
|
||||
@include('partials.head')
|
||||
<body>
|
||||
@include('partials.header')
|
||||
<div class="container main-layout">
|
||||
<main class="content">
|
||||
<h1 class="list-title">文章归档</h1>
|
||||
|
||||
@forelse($archives as $year => $months)
|
||||
<h2 class="archive-year">{{ $year }} 年</h2>
|
||||
<ul class="archive-list">
|
||||
@foreach($months as $month => $monthPosts)
|
||||
<li>
|
||||
<a href="{{ route('archives.month', [$year, $month]) }}">{{ (int) $month }} 月</a>
|
||||
<span class="count">({{ $monthPosts->count() }} 篇)</span>
|
||||
<ul class="archive-posts">
|
||||
@foreach($monthPosts as $post)
|
||||
<li><a href="{{ route('posts.show', $post->slug ?: $post->id) }}">{{ $post->title }}</a> <time>{{ $post->published_at->format('m-d') }}</time></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@empty
|
||||
<div class="empty">暂无归档</div>
|
||||
@endforelse
|
||||
</main>
|
||||
@include('partials.sidebar')
|
||||
</div>
|
||||
@include('partials.footer')
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,28 @@
|
||||
@php $pageTitle = '最新评论 - '.$siteName; @endphp
|
||||
@include('partials.head')
|
||||
<body>
|
||||
@include('partials.header')
|
||||
<div class="container main-layout">
|
||||
<main class="content">
|
||||
<h1 class="list-title">最新评论</h1>
|
||||
|
||||
@forelse($comments as $comment)
|
||||
<div class="comment" id="comment-{{ $comment->id }}">
|
||||
<div class="comment-head">
|
||||
<strong>{{ $comment->author_name }}</strong>
|
||||
<span>· 评论于 <a href="{{ route('posts.show', $comment->post->slug ?: $comment->post->id) }}#comment-{{ $comment->id }}">{{ $comment->post->title }}</a></span>
|
||||
<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
|
||||
<div class="empty">暂无评论</div>
|
||||
@endforelse
|
||||
|
||||
{{ $comments->links('partials.pagination-links') }}
|
||||
</main>
|
||||
@include('partials.sidebar')
|
||||
</div>
|
||||
@include('partials.footer')
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,32 @@
|
||||
{!! $xmlDeclaration !!}
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
|
||||
<channel>
|
||||
<title>{{ $siteName }}</title>
|
||||
<link>{{ url('/') }}</link>
|
||||
<description>{{ $siteDescription }}</description>
|
||||
<language>zh-CN</language>
|
||||
<atom:link href="{{ route('feed.rss') }}" rel="self" type="application/rss+xml"/>
|
||||
<lastBuildDate>{{ now()->toRssString() }}</lastBuildDate>
|
||||
@foreach($posts as $post)
|
||||
<item>
|
||||
<title>{{ $post->title }}</title>
|
||||
<link>{{ route('posts.show', $post->slug ?: $post->id) }}</link>
|
||||
<guid isPermaLink="true">{{ route('posts.show', $post->slug ?: $post->id) }}</guid>
|
||||
<pubDate>{{ $post->published_at->toRssString() }}</pubDate>
|
||||
<description>{{ Str::limit(strip_tags($post->excerpt_or_fallback), 300) }}</description>
|
||||
@if($post->category)
|
||||
<category>{{ $post->category->name }}</category>
|
||||
@endif
|
||||
@foreach($post->tags as $tag)
|
||||
<category>{{ $tag->name }}</category>
|
||||
@endforeach
|
||||
@if($post->author)
|
||||
<author>{{ $post->author->email }} ({{ $post->author->name }})</author>
|
||||
@endif
|
||||
<content:encoded><![CDATA[
|
||||
{!! app(\App\Blog\Services\PostContentRenderer::class)->render($post) !!}
|
||||
]]></content:encoded>
|
||||
</item>
|
||||
@endforeach
|
||||
</channel>
|
||||
</rss>
|
||||
@@ -0,0 +1,26 @@
|
||||
{!! $xmlDeclaration !!}
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>{{ route('home') }}</loc>
|
||||
<changefreq>daily</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>{{ route('archives') }}</loc>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>0.6</priority>
|
||||
</url>
|
||||
<url>
|
||||
<loc>{{ route('tags') }}</loc>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>0.4</priority>
|
||||
</url>
|
||||
@foreach($posts as $post)
|
||||
<url>
|
||||
<loc>{{ route('posts.show', $post->slug ?: $post->id) }}</loc>
|
||||
<lastmod>{{ $post->updated_at?->toAtomString() }}</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
@endforeach
|
||||
</urlset>
|
||||
@@ -0,0 +1,25 @@
|
||||
@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
|
||||
|
||||
@forelse($posts as $post)
|
||||
@include('partials.post-card', ['post' => $post])
|
||||
@empty
|
||||
<div class="empty">暂无文章</div>
|
||||
@endforelse
|
||||
|
||||
@include('partials.pagination', ['paginator' => $posts])
|
||||
</main>
|
||||
@include('partials.sidebar')
|
||||
</div>
|
||||
@include('partials.footer')
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,23 @@
|
||||
@php $pageTitle = '友情链接 - '.$siteName; @endphp
|
||||
@include('partials.head')
|
||||
<body>
|
||||
@include('partials.header')
|
||||
<div class="container main-layout">
|
||||
<main class="content">
|
||||
<h1 class="list-title">友情链接</h1>
|
||||
<ul class="links-list">
|
||||
@forelse($links as $link)
|
||||
<li>
|
||||
<a href="{{ $link->url }}" target="_blank" rel="noopener nofollow">{{ $link->name }}</a>
|
||||
@if($link->note)<span class="link-note">— {{ $link->note }}</span>@endif
|
||||
</li>
|
||||
@empty
|
||||
<div class="empty">暂无链接</div>
|
||||
@endforelse
|
||||
</ul>
|
||||
</main>
|
||||
@include('partials.sidebar')
|
||||
</div>
|
||||
@include('partials.footer')
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,23 @@
|
||||
@php
|
||||
$pageTitle = ($archiveTitle ?? $category->name ?? '文章列表').' - '.$siteName;
|
||||
@endphp
|
||||
@include('partials.head')
|
||||
<body>
|
||||
@include('partials.header')
|
||||
<div class="container main-layout">
|
||||
<main class="content">
|
||||
<h1 class="list-title">{{ $archiveTitle ?? ($category->name ?? '文章列表') }}</h1>
|
||||
|
||||
@forelse($posts as $post)
|
||||
@include('partials.post-card', ['post' => $post])
|
||||
@empty
|
||||
<div class="empty">该分类暂无文章</div>
|
||||
@endforelse
|
||||
|
||||
@include('partials.pagination', ['paginator' => $posts])
|
||||
</main>
|
||||
@include('partials.sidebar')
|
||||
</div>
|
||||
@include('partials.footer')
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,29 @@
|
||||
@php $pageTitle = '登录 - '.$siteName; @endphp
|
||||
@include('partials.head')
|
||||
<body>
|
||||
@include('partials.header')
|
||||
<div class="container auth-layout">
|
||||
<main class="auth-box">
|
||||
<h1 class="list-title">登录</h1>
|
||||
<form method="post" action="{{ route('login') }}">
|
||||
@csrf
|
||||
<div class="form-row">
|
||||
<label>账号(邮箱或用户名)</label>
|
||||
<input type="text" name="email" required value="{{ old('email') }}" autofocus>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label>密码</label>
|
||||
<input type="password" name="password" required>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label><input type="checkbox" name="remember"> 记住我</label>
|
||||
</div>
|
||||
@error('email')<p class="error">{{ $message }}</p>@enderror
|
||||
<button type="submit" class="btn btn-primary">登录</button>
|
||||
</form>
|
||||
<p class="auth-alt">还没有账号?<a href="{{ route('register') }}">立即注册</a></p>
|
||||
</main>
|
||||
</div>
|
||||
@include('partials.footer')
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,11 @@
|
||||
<footer class="site-footer">
|
||||
<div class="container">
|
||||
<p>
|
||||
© {{ date('Y') }} {{ $siteName }}
|
||||
@if($siteIcp)
|
||||
<a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener">{{ $siteIcp }}</a>
|
||||
@endif
|
||||
</p>
|
||||
<p class="powered">Powered by <a href="https://laravel.com" target="_blank" rel="noopener">Laravel</a> & <a href="https://filamentphp.com" target="_blank" rel="noopener">Filament</a></p>
|
||||
</div>
|
||||
</footer>
|
||||
@@ -0,0 +1,17 @@
|
||||
<!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">
|
||||
<title>{{ $pageTitle ?? $siteName }}</title>
|
||||
<meta name="description" content="{{ $pageDescription ?? $siteDescription }}">
|
||||
@if(($pageKeywords ?? '') !== '')
|
||||
<meta name="keywords" content="{{ $pageKeywords }}">
|
||||
@endif
|
||||
<meta name="generator" content="LaraLog">
|
||||
<link rel="canonical" href="{{ url()->current() }}">
|
||||
<link rel="alternate" type="application/rss+xml" title="{{ $siteName }}" href="{{ route('feed.rss') }}">
|
||||
<link rel="stylesheet" href="{{ asset('css/blog.css') }}">
|
||||
@stack('head')
|
||||
</head>
|
||||
@@ -0,0 +1,30 @@
|
||||
<header class="site-header">
|
||||
<div class="container">
|
||||
<div class="site-brand">
|
||||
<a href="{{ route('home') }}" class="site-title">{{ $siteName }}</a>
|
||||
@if($siteDescription)
|
||||
<p class="site-desc">{{ $siteDescription }}</p>
|
||||
@endif
|
||||
</div>
|
||||
<nav class="site-nav">
|
||||
<a href="{{ route('home') }}" class="{{ request()->routeIs('home') ? 'active' : '' }}">首页</a>
|
||||
<a href="{{ route('archives') }}" class="{{ request()->routeIs('archives*') ? 'active' : '' }}">归档</a>
|
||||
<a href="{{ route('tags') }}" class="{{ request()->routeIs('tags*') ? 'active' : '' }}">标签</a>
|
||||
<a href="{{ route('links') }}" class="{{ request()->routeIs('links') ? 'active' : '' }}">友链</a>
|
||||
<a href="{{ route('comments') }}" class="{{ request()->routeIs('comments') ? 'active' : '' }}">评论</a>
|
||||
<form class="site-search" action="{{ route('search') }}" method="get">
|
||||
<input type="search" name="q" placeholder="搜索..." value="{{ request('q', request('keyword', '')) }}">
|
||||
</form>
|
||||
@auth
|
||||
<a href="{{ route('profile') }}">{{ auth()->user()->name }}</a>
|
||||
<form action="{{ route('logout') }}" method="post" class="inline-form">
|
||||
@csrf
|
||||
<button type="submit" class="link-btn">退出</button>
|
||||
</form>
|
||||
@else
|
||||
<a href="{{ route('login') }}">登录</a>
|
||||
<a href="{{ route('register') }}">注册</a>
|
||||
@endauth
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
@@ -0,0 +1,33 @@
|
||||
@if ($paginator->hasPages())
|
||||
<nav class="pagination-links" role="navigation">
|
||||
{{-- Previous --}}
|
||||
@if ($paginator->onFirstPage())
|
||||
<span class="disabled">« 上一页</span>
|
||||
@else
|
||||
<a href="{{ $paginator->previousPageUrl() }}" rel="prev">« 上一页</a>
|
||||
@endif
|
||||
|
||||
{{-- Numbers --}}
|
||||
@foreach ($elements as $element)
|
||||
@if (is_string($element))
|
||||
<span class="disabled">{{ $element }}</span>
|
||||
@endif
|
||||
@if (is_array($element))
|
||||
@foreach ($element as $page => $url)
|
||||
@if ($page == $paginator->currentPage())
|
||||
<span class="current">{{ $page }}</span>
|
||||
@else
|
||||
<a href="{{ $url }}">{{ $page }}</a>
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
{{-- Next --}}
|
||||
@if ($paginator->hasMorePages())
|
||||
<a href="{{ $paginator->nextPageUrl() }}" rel="next">下一页 »</a>
|
||||
@else
|
||||
<span class="disabled">下一页 »</span>
|
||||
@endif
|
||||
</nav>
|
||||
@endif
|
||||
@@ -0,0 +1,5 @@
|
||||
@if ($paginator->hasPages())
|
||||
<nav class="pagination">
|
||||
{{ $paginator->links('partials.pagination-links') }}
|
||||
</nav>
|
||||
@endif
|
||||
@@ -0,0 +1,29 @@
|
||||
<article class="post-card {{ $post->is_sticky ? 'sticky' : '' }}">
|
||||
@if($cover = $post->getFirstMedia('cover'))
|
||||
<a href="{{ route('posts.show', $post->slug ?: $post->id) }}" class="post-cover">
|
||||
<img src="{{ $cover->getUrl('card') ?: $cover->getUrl() }}" alt="{{ $post->title }}" loading="lazy">
|
||||
</a>
|
||||
@endif
|
||||
<h2 class="post-title">
|
||||
@if($post->is_sticky)<span class="badge">置顶</span>@endif
|
||||
<a href="{{ route('posts.show', $post->slug ?: $post->id) }}">{{ $post->title }}</a>
|
||||
</h2>
|
||||
<div class="post-meta">
|
||||
<time datetime="{{ $post->published_at->toIso8601String() }}">{{ $post->published_at->format('Y-m-d H:i') }}</time>
|
||||
@if($post->category)
|
||||
<span>·</span>
|
||||
<a href="{{ route('category.show', $post->category->slug ?: $post->category->id) }}">{{ $post->category->name }}</a>
|
||||
@endif
|
||||
<span>· 阅读 {{ $post->views }}</span>
|
||||
<span>· 评论 {{ $post->comment_count }}</span>
|
||||
</div>
|
||||
<div class="post-excerpt">
|
||||
{{ Str::limit(strip_tags($post->excerpt_or_fallback), 200) }}
|
||||
</div>
|
||||
<div class="post-footer">
|
||||
<a href="{{ route('posts.show', $post->slug ?: $post->id) }}" class="read-more">阅读全文 »</a>
|
||||
@foreach($post->tags as $tag)
|
||||
<a href="{{ route('tags.show', $tag->slug ?: $tag->name) }}" class="tag-link">#{{ $tag->name }}</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</article>
|
||||
@@ -0,0 +1,73 @@
|
||||
<aside class="sidebar">
|
||||
<section class="widget">
|
||||
<h3 class="widget-title">分类</h3>
|
||||
<ul class="widget-list">
|
||||
@forelse($categories as $category)
|
||||
<li>
|
||||
<a href="{{ route('category.show', $category->slug ?: $category->id) }}">{{ $category->name }}</a>
|
||||
<span class="count">({{ $category->post_count }})</span>
|
||||
</li>
|
||||
@empty
|
||||
<li>暂无分类</li>
|
||||
@endforelse
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="widget">
|
||||
<h3 class="widget-title">最新文章</h3>
|
||||
<ul class="widget-list">
|
||||
@forelse($recentPosts as $post)
|
||||
<li><a href="{{ route('posts.show', $post->slug ?: $post->id) }}">{{ $post->title }}</a></li>
|
||||
@empty
|
||||
<li>暂无文章</li>
|
||||
@endforelse
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="widget">
|
||||
<h3 class="widget-title">最新评论</h3>
|
||||
<ul class="widget-list">
|
||||
@forelse($recentComments as $comment)
|
||||
<li>
|
||||
<a href="{{ route('posts.show', $comment->post->slug ?: $comment->post->id) }}#comment-{{ $comment->id }}">
|
||||
{{ $comment->author_name }}:{{ Str::limit(strip_tags($comment->content), 30) }}
|
||||
</a>
|
||||
</li>
|
||||
@empty
|
||||
<li>暂无评论</li>
|
||||
@endforelse
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="widget">
|
||||
<h3 class="widget-title">标签云</h3>
|
||||
<div class="tag-cloud">
|
||||
@forelse($hotTags as $tag)
|
||||
<a href="{{ route('tags.show', $tag->slug ?: $tag->name) }}" class="tag-link">{{ $tag->name }}</a>
|
||||
@empty
|
||||
<span>暂无标签</span>
|
||||
@endforelse
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="widget">
|
||||
<h3 class="widget-title">友情链接</h3>
|
||||
<ul class="widget-list">
|
||||
@forelse($links as $link)
|
||||
<li><a href="{{ $link->url }}" target="_blank" rel="noopener">{{ $link->name }}</a></li>
|
||||
@empty
|
||||
<li>暂无链接</li>
|
||||
@endforelse
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section class="widget">
|
||||
<h3 class="widget-title">站点统计</h3>
|
||||
<ul class="widget-list">
|
||||
<li>文章:{{ $blogStats['posts'] }} 篇</li>
|
||||
<li>评论:{{ $blogStats['comments'] }} 条</li>
|
||||
<li>分类:{{ $blogStats['categories'] }} 个</li>
|
||||
<li>标签:{{ $blogStats['tags'] }} 个</li>
|
||||
</ul>
|
||||
</section>
|
||||
</aside>
|
||||
@@ -0,0 +1,24 @@
|
||||
@php $pageTitle = '个人中心 - '.$siteName; $user = auth()->user(); @endphp
|
||||
@include('partials.head')
|
||||
<body>
|
||||
@include('partials.header')
|
||||
<div class="container main-layout">
|
||||
<main class="content">
|
||||
<h1 class="list-title">个人中心</h1>
|
||||
<div class="profile-box">
|
||||
<p><strong>昵称:</strong>{{ $user->name }}</p>
|
||||
<p><strong>邮箱:</strong>{{ $user->email }}</p>
|
||||
@if($user->url)<p><strong>主页:</strong><a href="{{ $user->url }}" target="_blank" rel="noopener nofollow">{{ $user->url }}</a></p>@endif
|
||||
<p><strong>注册时间:</strong>{{ $user->created_at?->format('Y-m-d') }}</p>
|
||||
<p><strong>登录次数:</strong>{{ $user->logincount }}</p>
|
||||
<p><strong>角色:</strong>{{ $user->getRoleNames()->implode(', ') ?: '会员' }}</p>
|
||||
<p><strong>我的文章:</strong>{{ $user->posts()->count() }} 篇</p>
|
||||
<p><strong>我的评论:</strong>{{ $user->comments()->count() }} 条</p>
|
||||
</div>
|
||||
<p><a href="{{ route('home') }}">« 返回首页</a></p>
|
||||
</main>
|
||||
@include('partials.sidebar')
|
||||
</div>
|
||||
@include('partials.footer')
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,40 @@
|
||||
@php $pageTitle = '注册 - '.$siteName; @endphp
|
||||
@include('partials.head')
|
||||
<body>
|
||||
@include('partials.header')
|
||||
<div class="container auth-layout">
|
||||
<main class="auth-box">
|
||||
<h1 class="list-title">注册</h1>
|
||||
<form method="post" action="{{ route('register') }}">
|
||||
@csrf
|
||||
<div class="form-row">
|
||||
<label>昵称</label>
|
||||
<input type="text" name="name" required value="{{ old('name') }}">
|
||||
@error('name')<p class="error">{{ $message }}</p>@enderror
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label>邮箱</label>
|
||||
<input type="email" name="email" required value="{{ old('email') }}">
|
||||
@error('email')<p class="error">{{ $message }}</p>@enderror
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label>密码(至少 8 位)</label>
|
||||
<input type="password" name="password" required>
|
||||
@error('password')<p class="error">{{ $message }}</p>@enderror
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label>确认密码</label>
|
||||
<input type="password" name="password_confirmation" required>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label>个人主页(可选)</label>
|
||||
<input type="url" name="url" value="{{ old('url') }}">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">注册</button>
|
||||
</form>
|
||||
<p class="auth-alt">已有账号?<a href="{{ route('login') }}">去登录</a></p>
|
||||
</main>
|
||||
</div>
|
||||
@include('partials.footer')
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,25 @@
|
||||
@php $pageTitle = '搜索 - '.$siteName; @endphp
|
||||
@include('partials.head')
|
||||
<body>
|
||||
@include('partials.header')
|
||||
<div class="container main-layout">
|
||||
<main class="content">
|
||||
<h1 class="list-title">搜索:{{ $keyword ?: '全部' }}</h1>
|
||||
<form action="{{ route('search') }}" method="get" class="search-form">
|
||||
<input type="search" name="q" value="{{ $keyword }}" placeholder="输入关键词搜索文章">
|
||||
<button type="submit" class="btn">搜索</button>
|
||||
</form>
|
||||
|
||||
@forelse($posts as $post)
|
||||
@include('partials.post-card', ['post' => $post])
|
||||
@empty
|
||||
<div class="empty">没有找到相关文章</div>
|
||||
@endforelse
|
||||
|
||||
@include('partials.pagination', ['paginator' => $posts])
|
||||
</main>
|
||||
@include('partials.sidebar')
|
||||
</div>
|
||||
@include('partials.footer')
|
||||
</body>
|
||||
</html>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,21 @@
|
||||
@php $pageTitle = '标签:'.$tag->name.' - '.$siteName; @endphp
|
||||
@include('partials.head')
|
||||
<body>
|
||||
@include('partials.header')
|
||||
<div class="container main-layout">
|
||||
<main class="content">
|
||||
<h1 class="list-title">标签:{{ $tag->name }}</h1>
|
||||
|
||||
@forelse($posts as $post)
|
||||
@include('partials.post-card', ['post' => $post])
|
||||
@empty
|
||||
<div class="empty">该标签暂无文章</div>
|
||||
@endforelse
|
||||
|
||||
@include('partials.pagination', ['paginator' => $posts])
|
||||
</main>
|
||||
@include('partials.sidebar')
|
||||
</div>
|
||||
@include('partials.footer')
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,22 @@
|
||||
@php $pageTitle = '标签 - '.$siteName; @endphp
|
||||
@include('partials.head')
|
||||
<body>
|
||||
@include('partials.header')
|
||||
<div class="container main-layout">
|
||||
<main class="content">
|
||||
<h1 class="list-title">全部标签</h1>
|
||||
<div class="tag-cloud big">
|
||||
@forelse($tags as $tag)
|
||||
<a href="{{ route('tags.show', $tag->slug ?: $tag->name) }}" class="tag-link" style="font-size: {{ max(0.9, min(1.8, 0.9 + $tag->posts_count * 0.1)) }}em">
|
||||
{{ $tag->name }} ({{ $tag->posts_count }})
|
||||
</a>
|
||||
@empty
|
||||
<div class="empty">暂无标签</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</main>
|
||||
@include('partials.sidebar')
|
||||
</div>
|
||||
@include('partials.footer')
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user