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
+11
View File
@@ -0,0 +1,11 @@
<footer class="site-footer">
<div class="container">
<p>
&copy; {{ 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> &amp; <a href="https://filamentphp.com" target="_blank" rel="noopener">Filament</a></p>
</div>
</footer>
+17
View File
@@ -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>
+30
View File
@@ -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">&laquo; 上一页</span>
@else
<a href="{{ $paginator->previousPageUrl() }}" rel="prev">&laquo; 上一页</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">下一页 &raquo;</a>
@else
<span class="disabled">下一页 &raquo;</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">阅读全文 &raquo;</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>