M2: 主题系统(sablog经典+modern简约)+ 前台全部页面 + 老 URL 301 兼容 + markdown 双份导入
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
/* ============ Modern 简约主题 ============ */
|
||||
:root {
|
||||
--bg: #fafafa;
|
||||
--card: #fff;
|
||||
--text: #1a1a1a;
|
||||
--muted: #767676;
|
||||
--accent: #e74c3c;
|
||||
--border: #eaeaea;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--bg: #151515;
|
||||
--card: #1e1e1e;
|
||||
--text: #e8e8e8;
|
||||
--muted: #9a9a9a;
|
||||
--accent: #ff6b5e;
|
||||
--border: #2c2c2c;
|
||||
}
|
||||
}
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 16px; line-height: 1.8; }
|
||||
a { color: var(--accent); text-decoration: none; }
|
||||
a:hover { opacity: 0.8; }
|
||||
.m-container { max-width: 720px; margin: 0 auto; padding: 0 20px; }
|
||||
|
||||
.m-header { border-bottom: 1px solid var(--border); background: var(--card); }
|
||||
.m-header .m-container { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; }
|
||||
.m-logo { font-size: 22px; font-weight: 800; letter-spacing: 1px; color: var(--text); }
|
||||
.m-nav { display: flex; gap: 18px; font-size: 14px; align-items: center; }
|
||||
.m-nav a.active { font-weight: 700; }
|
||||
.m-link-btn { background: none; border: none; color: var(--accent); font-size: 14px; cursor: pointer; padding: 0; }
|
||||
.inline-form { display: inline; }
|
||||
|
||||
.main-layout { padding: 36px 20px; }
|
||||
.main-layout .content { max-width: 720px; margin: 0 auto; }
|
||||
|
||||
.post-card, .post-full, .comments-section { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 26px 30px; margin-bottom: 22px; }
|
||||
.post-card.sticky { box-shadow: inset 3px 0 0 var(--accent); }
|
||||
.post-title { font-size: 20px; margin-bottom: 8px; line-height: 1.45; }
|
||||
.post-card .post-title a { color: var(--text); }
|
||||
.badge { background: var(--accent); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 3px; margin-right: 6px; vertical-align: 2px; }
|
||||
.post-meta { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
|
||||
.post-excerpt { color: var(--muted); }
|
||||
.post-footer { margin-top: 12px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 14px; }
|
||||
.read-more { font-weight: 600; }
|
||||
|
||||
.post-full .post-title { font-size: 28px; }
|
||||
.post-content { margin-top: 14px; }
|
||||
.post-content img { max-width: 100%; border-radius: 8px; }
|
||||
.post-content pre { background: #0d1117; color: #c9d1d9; padding: 16px; border-radius: 8px; overflow-x: auto; margin: 14px 0; }
|
||||
.post-content code { background: rgba(128,128,128,.15); padding: 2px 6px; border-radius: 4px; font-size: 14px; }
|
||||
.post-content pre code { background: none; padding: 0; }
|
||||
.post-content blockquote { border-left: 3px solid var(--accent); padding-left: 16px; color: var(--muted); margin: 14px 0; }
|
||||
.post-content h1, .post-content h2, .post-content h3 { margin: 20px 0 8px; }
|
||||
|
||||
.post-cover { margin: -26px -30px 18px; border-radius: 12px 12px 0 0; overflow: hidden; }
|
||||
.post-cover img { width: 100%; display: block; max-height: 380px; object-fit: cover; }
|
||||
|
||||
.tag-link { color: var(--accent); font-size: 14px; margin-right: 8px; }
|
||||
|
||||
.comments-section { margin-top: 8px; }
|
||||
.section-title { font-size: 17px; margin-bottom: 14px; }
|
||||
.comment { padding: 12px 0; border-bottom: 1px solid var(--border); }
|
||||
.comment:last-of-type { border-bottom: none; }
|
||||
.comment-head { font-size: 14px; margin-bottom: 4px; }
|
||||
.comment-time { color: var(--muted); font-size: 13px; }
|
||||
.comment-body { color: var(--text); font-size: 15px; }
|
||||
.comment-form { margin-top: 14px; }
|
||||
.form-row { margin-bottom: 12px; }
|
||||
.form-row label { display: block; font-size: 14px; margin-bottom: 4px; color: var(--muted); }
|
||||
.form-row input, .form-row textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 15px; font-family: inherit; }
|
||||
.honeypot { position: absolute; left: -9999px; opacity: 0; }
|
||||
.error { color: var(--accent); font-size: 13px; }
|
||||
.btn { background: var(--accent); color: #fff; border: none; padding: 10px 24px; border-radius: 8px; font-size: 15px; cursor: pointer; }
|
||||
.alert { padding: 12px 18px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
|
||||
.alert-success { background: rgba(46,160,67,.12); color: #2ea043; }
|
||||
.alert-error { background: rgba(248,81,73,.12); color: #f85149; }
|
||||
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
|
||||
|
||||
.list-title { font-size: 24px; margin-bottom: 20px; }
|
||||
|
||||
.archive-year { font-size: 16px; margin: 16px 0 6px; }
|
||||
.archive-list { list-style: none; }
|
||||
.archive-posts { margin: 4px 0 12px 22px; }
|
||||
.archive-posts time { color: var(--muted); font-size: 13px; }
|
||||
|
||||
.pagination { margin: 16px 0; }
|
||||
.pagination-links { display: flex; gap: 8px; flex-wrap: wrap; }
|
||||
.pagination-links a, .pagination-links .current, .pagination-links .disabled { padding: 6px 14px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; background: var(--card); color: var(--text); }
|
||||
.pagination-links .current { background: var(--accent); color: #fff; border-color: var(--accent); }
|
||||
.pagination-links .disabled { color: var(--muted); }
|
||||
|
||||
.m-footer { border-top: 1px solid var(--border); padding: 26px 0 40px; margin-top: 30px; text-align: center; color: var(--muted); font-size: 13px; }
|
||||
|
||||
.tag-cloud.big { line-height: 2.4; }
|
||||
.links-list { list-style: none; }
|
||||
.links-list li { padding: 6px 0; }
|
||||
.link-note { color: var(--muted); font-size: 14px; }
|
||||
|
||||
.auth-layout { display: flex; justify-content: center; padding: 50px 20px; }
|
||||
.auth-box { width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 30px; }
|
||||
.auth-alt { margin-top: 14px; font-size: 14px; color: var(--muted); text-align: center; }
|
||||
.search-form { margin-bottom: 16px; display: flex; gap: 8px; }
|
||||
.search-form input { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-size: 15px; }
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"title": "Modern 简约",
|
||||
"version": "1.0.0",
|
||||
"description": "极简现代风格,支持深色模式",
|
||||
"author": "LaraLog",
|
||||
"screenshot": null
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<footer class="m-footer">
|
||||
<div class="m-container">
|
||||
<p>© {{ date('Y') }} {{ $siteName }}
|
||||
@if($siteIcp)<a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener">{{ $siteIcp }}</a>@endif
|
||||
</p>
|
||||
<p>LaraLog · 用 Markdown 书写,用 AI 审核</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="{{ theme('asset', 'style.css') }}">
|
||||
@stack('head')
|
||||
</head>
|
||||
@@ -0,0 +1,20 @@
|
||||
<header class="m-header">
|
||||
<div class="m-container">
|
||||
<a href="{{ route('home') }}" class="m-logo">{{ $siteName }}</a>
|
||||
<nav class="m-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>
|
||||
@auth
|
||||
<a href="{{ route('profile') }}">{{ auth()->user()->name }}</a>
|
||||
<form action="{{ route('logout') }}" method="post" class="inline-form">
|
||||
@csrf
|
||||
<button type="submit" class="m-link-btn">退出</button>
|
||||
</form>
|
||||
@else
|
||||
<a href="{{ route('login') }}">登录</a>
|
||||
@endauth
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
@@ -0,0 +1,115 @@
|
||||
/* ============ Sablog 经典主题 ============ */
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
|
||||
body {
|
||||
background: #eef2f5 url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==) repeat-x top;
|
||||
font-family: Verdana, "PingFang SC", "Microsoft YaHei", sans-serif;
|
||||
font-size: 13px;
|
||||
color: #333;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
a { color: #1c62b0; text-decoration: none; }
|
||||
a:hover { color: #f60; text-decoration: underline; }
|
||||
|
||||
#outmain { width: 960px; margin: 0 auto; }
|
||||
|
||||
#header { padding: 22px 10px 8px; }
|
||||
.logo a { font-size: 30px; font-weight: bold; color: #1c62b0; font-family: Georgia, serif; }
|
||||
.logo .description { color: #888; font-size: 12px; }
|
||||
|
||||
#nav { margin-top: 14px; border-top: 1px solid #d8dfe6; border-bottom: 1px solid #d8dfe6; background: #f7f9fb; }
|
||||
#nav ul { list-style: none; display: flex; flex-wrap: wrap; }
|
||||
#nav li { border-right: 1px solid #d8dfe6; }
|
||||
#nav a { display: block; padding: 7px 18px; color: #333; font-weight: bold; font-size: 13px; }
|
||||
#nav a:hover { background: #1c62b0; color: #fff; text-decoration: none; }
|
||||
#nav .current_page_item a { background: #1c62b0; color: #fff; }
|
||||
|
||||
#page { padding: 14px 10px; display: flex; gap: 18px; align-items: flex-start; }
|
||||
|
||||
#content { flex: 1; min-width: 0; }
|
||||
|
||||
.post-card, .post-full, .comments-section, .auth-box, .profile-box, .links-list {
|
||||
background: #fff;
|
||||
border: 1px solid #d8dfe6;
|
||||
padding: 18px 20px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.post-card.sticky { border-left: 4px solid #f60; }
|
||||
.post-title { font-size: 17px; margin-bottom: 6px; line-height: 1.4; }
|
||||
.post-card .post-title a { color: #1c62b0; }
|
||||
.badge { background: #f60; color: #fff; font-size: 11px; padding: 1px 5px; margin-right: 5px; }
|
||||
.post-meta { color: #999; font-size: 12px; margin-bottom: 8px; }
|
||||
.post-excerpt { color: #555; margin-bottom: 8px; }
|
||||
.post-footer { font-size: 12px; }
|
||||
.tag-link { color: #1c62b0; margin-right: 8px; }
|
||||
|
||||
.post-full .post-title { font-size: 22px; color: #1c62b0; }
|
||||
.post-content { margin-top: 10px; font-size: 14px; }
|
||||
.post-content img { max-width: 100%; }
|
||||
.post-content pre { background: #f4f4f4; border: 1px solid #ddd; padding: 10px; overflow: auto; margin: 10px 0; }
|
||||
.post-content blockquote { border-left: 4px solid #1c62b0; padding-left: 12px; color: #666; margin: 10px 0; }
|
||||
.post-content h1, .post-content h2, .post-content h3 { margin: 14px 0 6px; }
|
||||
|
||||
.post-cover { margin: -18px -20px 12px; }
|
||||
.post-cover img { width: 100%; display: block; max-height: 320px; object-fit: cover; }
|
||||
|
||||
.comment { padding: 10px 0; border-bottom: 1px dashed #ddd; }
|
||||
.comment-head { font-size: 12px; margin-bottom: 3px; }
|
||||
.comment-time { color: #999; }
|
||||
.comment-body { font-size: 13px; }
|
||||
.comment-form { margin-top: 12px; }
|
||||
.form-row { margin-bottom: 8px; }
|
||||
.form-row label { display: block; font-size: 12px; margin-bottom: 3px; }
|
||||
.form-row input, .form-row textarea { width: 100%; padding: 6px 8px; border: 1px solid #ccc; font-size: 13px; font-family: inherit; }
|
||||
.honeypot { position: absolute; left: -9999px; opacity: 0; }
|
||||
.btn { background: #1c62b0; color: #fff; border: none; padding: 7px 18px; font-size: 13px; cursor: pointer; }
|
||||
.btn:hover { background: #f60; }
|
||||
.error { color: #c00; font-size: 12px; }
|
||||
.alert { padding: 8px 12px; margin-bottom: 12px; border: 1px solid; }
|
||||
.alert-success { background: #e8f5e9; border-color: #a5d6a7; color: #2e7d32; }
|
||||
.alert-error { background: #fdecea; border-color: #f5c6cb; color: #c62828; }
|
||||
.empty { color: #999; text-align: center; padding: 20px 0; }
|
||||
.list-title { font-size: 18px; margin-bottom: 12px; color: #1c62b0; }
|
||||
|
||||
/* Sidebar */
|
||||
.sidebar { width: 280px; flex-shrink: 0; }
|
||||
.sidebar .searchbox { background: #fff; border: 1px solid #d8dfe6; padding: 10px; margin-bottom: 14px; }
|
||||
.sidebar .searchbox input[type=search] { width: 180px; padding: 4px; border: 1px solid #ccc; }
|
||||
.sidebar .widget { background: #fff; border: 1px solid #d8dfe6; margin-bottom: 14px; }
|
||||
.sidebar .widget h3 { background: #f7f9fb; border-bottom: 1px solid #d8dfe6; font-size: 13px; padding: 7px 12px; color: #1c62b0; }
|
||||
.sidebar .widget ul { list-style: none; padding: 6px 12px; }
|
||||
.sidebar .widget li { padding: 3px 0; font-size: 12px; border-bottom: 1px dotted #eee; }
|
||||
.sidebar .tagcloud { padding: 8px 12px; }
|
||||
.sidebar .tagcloud a { color: #1c62b0; margin-right: 6px; }
|
||||
|
||||
/* 兜底页面(归档/标签云/友链/评论/登录等使用默认布局) */
|
||||
.main-layout { display: flex; gap: 18px; align-items: flex-start; padding: 14px 10px; }
|
||||
.main-layout .content { flex: 1; min-width: 0; }
|
||||
.main-layout .sidebar { width: 280px; }
|
||||
|
||||
.pagination-links { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
|
||||
.pagination-links a, .pagination-links .current, .pagination-links .disabled { padding: 4px 10px; border: 1px solid #d8dfe6; background: #fff; font-size: 12px; }
|
||||
.pagination-links .current { background: #1c62b0; color: #fff; }
|
||||
|
||||
#footer { clear: both; text-align: center; padding: 14px 0 24px; color: #888; font-size: 12px; }
|
||||
#footer a { color: #1c62b0; }
|
||||
|
||||
.archive-year { font-size: 15px; margin: 12px 0 4px; color: #1c62b0; }
|
||||
.archive-list { list-style: none; }
|
||||
.archive-posts { margin: 4px 0 10px 20px; }
|
||||
|
||||
.links-list { list-style: none; }
|
||||
.links-list li { padding: 5px 0; }
|
||||
.link-note { color: #999; }
|
||||
|
||||
.tag-cloud.big { line-height: 2.4; }
|
||||
|
||||
.auth-layout { display: flex; justify-content: center; padding: 30px 10px; }
|
||||
.auth-box { width: 100%; max-width: 420px; }
|
||||
.auth-alt { margin-top: 12px; font-size: 12px; }
|
||||
.search-form { margin-bottom: 12px; }
|
||||
.search-form input { padding: 5px; border: 1px solid #ccc; width: 220px; }
|
||||
|
||||
.inline-form { display: inline; }
|
||||
.link-btn { background: none; border: none; color: #1c62b0; cursor: pointer; font-size: 13px; padding: 0; font-weight: bold; }
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"title": "Sablog 经典",
|
||||
"version": "1.0.0",
|
||||
"description": "移植自 SaBlog-X 经典两栏风格",
|
||||
"author": "LaraLog",
|
||||
"screenshot": null
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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>© {{ 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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user