M2: 主题系统(sablog经典+modern简约)+ 前台全部页面 + 老 URL 301 兼容 + markdown 双份导入

This commit is contained in:
ak
2026-08-11 17:58:29 +08:00
parent f16bb75538
commit 6214976a88
66 changed files with 2763 additions and 10 deletions
+23
View File
@@ -0,0 +1,23 @@
@include('partials.head')
<body>
@include('partials.header')
<div id="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])
</div>
@include('partials.sidebar')
@include('partials.footer')
</body>
</html>
+21
View File
@@ -0,0 +1,21 @@
@php
$pageTitle = ($archiveTitle ?? $category->name ?? '文章列表').' - '.$siteName;
@endphp
@include('partials.head')
<body>
@include('partials.header')
<div id="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])
</div>
@include('partials.sidebar')
@include('partials.footer')
</body>
</html>
@@ -0,0 +1,8 @@
<div id="footer">
<p>&copy; {{ date('Y') }} {{ $siteName }}
@if($siteIcp)<a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener">{{ $siteIcp }}</a>@endif
</p>
<p>Powered by LaraLog · Laravel · Filament</p>
</div>
</div>{{-- #page --}}
</div>{{-- #outmain --}}
@@ -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="{{ theme('asset', 'style.css') }}">
@stack('head')
</head>
@@ -0,0 +1,30 @@
<div id="outmain">
<div id="header">
<div class="logo">
<a href="{{ route('home') }}">{{ $siteName }}</a>
<p class="description">{{ $siteDescription }}</p>
</div>
<div id="nav">
<ul>
<li class="{{ request()->routeIs('home') ? 'current_page_item' : '' }}"><a href="{{ route('home') }}">首页</a></li>
<li class="{{ request()->routeIs('archives*') ? 'current_page_item' : '' }}"><a href="{{ route('archives') }}">归档</a></li>
<li class="{{ request()->routeIs('tags*') ? 'current_page_item' : '' }}"><a href="{{ route('tags') }}">标签</a></li>
<li class="{{ request()->routeIs('links') ? 'current_page_item' : '' }}"><a href="{{ route('links') }}">友链</a></li>
<li class="{{ request()->routeIs('comments') ? 'current_page_item' : '' }}"><a href="{{ route('comments') }}">评论</a></li>
<li><a href="{{ route('feed.rss') }}">RSS</a></li>
@auth
<li><a href="{{ route('profile') }}">{{ auth()->user()->name }}</a></li>
<li>
<form action="{{ route('logout') }}" method="post" class="inline-form">
@csrf
<button type="submit" class="link-btn">退出</button>
</form>
</li>
@else
<li><a href="{{ route('login') }}">登录</a></li>
<li><a href="{{ route('register') }}">注册</a></li>
@endauth
</ul>
</div>
</div>
<div id="page">
@@ -0,0 +1,72 @@
<div class="sidebar">
<div class="searchbox">
<form action="{{ route('search') }}" method="get">
<input type="search" name="q" value="{{ request('q', request('keyword', '')) }}" placeholder="搜索文章">
<input type="submit" value="搜索">
</form>
</div>
<div class="widget">
<h3>分类</h3>
<ul>
@forelse($categories as $category)
<li><a href="{{ route('category.show', $category->slug ?: $category->id) }}">{{ $category->name }}</a> ({{ $category->post_count }})</li>
@empty
<li>暂无分类</li>
@endforelse
</ul>
</div>
<div class="widget">
<h3>最新文章</h3>
<ul>
@forelse($recentPosts as $post)
<li><a href="{{ route('posts.show', $post->slug ?: $post->id) }}">{{ $post->title }}</a></li>
@empty
<li>暂无文章</li>
@endforelse
</ul>
</div>
<div class="widget">
<h3>最新评论</h3>
<ul>
@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), 20) }}</a></li>
@empty
<li>暂无评论</li>
@endforelse
</ul>
</div>
<div class="widget">
<h3>标签</h3>
<p class="tagcloud">
@forelse($hotTags as $tag)
<a href="{{ route('tags.show', $tag->slug ?: $tag->name) }}">{{ $tag->name }}</a>
@empty
暂无标签
@endforelse
</p>
</div>
<div class="widget">
<h3>友情链接</h3>
<ul>
@forelse($links as $link)
<li><a href="{{ $link->url }}" target="_blank" rel="noopener">{{ $link->name }}</a></li>
@empty
<li>暂无链接</li>
@endforelse
</ul>
</div>
<div class="widget">
<h3>统计</h3>
<ul>
<li>文章 {{ $blogStats['posts'] }} </li>
<li>评论 {{ $blogStats['comments'] }} </li>
<li>标签 {{ $blogStats['tags'] }} </li>
</ul>
</div>
</div>
+23
View File
@@ -0,0 +1,23 @@
@php $pageTitle = '搜索 - '.$siteName; @endphp
@include('partials.head')
<body>
@include('partials.header')
<div id="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])
</div>
@include('partials.sidebar')
@include('partials.footer')
</body>
</html>
+87
View File
@@ -0,0 +1,87 @@
@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 id="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
<button type="submit" class="btn">发表评论</button>
</form>
</section>
@endif
</div>
@include('partials.sidebar')
@include('partials.footer')
</body>
</html>
+19
View File
@@ -0,0 +1,19 @@
@php $pageTitle = '标签:'.$tag->name.' - '.$siteName; @endphp
@include('partials.head')
<body>
@include('partials.header')
<div id="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])
</div>
@include('partials.sidebar')
@include('partials.footer')
</body>
</html>