- 插件承载全部逻辑:redirects 迁移(hasTable 兼容旧库)、Redirect 模型、UrlRedirector、/go 路由+控制器、Filament 外链中转资源 - 核心只留 hook 接入点: - tracked_url() 助手走 link.redirect 过滤器(评论正文/作者网址/友链模板统一调用) - 正文外链改写移到插件的 post.rendered 过滤器(优先级 20,晚于会员付费过滤) - 停用插件:链接恢复直连、内容不受影响;后台「管理 → 外链中转」查看点击量/启停 - 测试更新为插件上下文(含无过滤器降级断言);97 通过
88 lines
2.9 KiB
PHP
88 lines
2.9 KiB
PHP
<aside class="sidebar">
|
||
@stack('theme:sidebar_top')
|
||
<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>
|
||
|
||
<section 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>
|
||
</section>
|
||
|
||
<section 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>
|
||
</section>
|
||
|
||
<section 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>
|
||
</section>
|
||
|
||
<section 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>
|
||
</section>
|
||
|
||
<section class="widget">
|
||
<h3>友情链接</h3>
|
||
<ul>
|
||
@forelse($links as $link)
|
||
<li><a href="{{ tracked_url($link->url) }}" target="_blank" rel="noopener">{{ $link->name }}</a></li>
|
||
@empty
|
||
<li>暂无链接</li>
|
||
@endforelse
|
||
</ul>
|
||
</section>
|
||
|
||
<section class="widget">
|
||
<h3>社交账号</h3>
|
||
<ul class="social-links">
|
||
@foreach($socialLinks as $social)
|
||
@if($social['url'])
|
||
<li><a href="{{ $social['url'] }}" target="_blank" rel="noopener nofollow">{{ $social['platform'] }}</a></li>
|
||
@else
|
||
<li>{{ $social['platform'] }}:{{ $social['value'] }}</li>
|
||
@endif
|
||
@endforeach
|
||
</ul>
|
||
</section>
|
||
|
||
<section class="widget">
|
||
<h3>统计</h3>
|
||
<ul>
|
||
<li>文章 {{ $blogStats['posts'] }} 篇</li>
|
||
<li>评论 {{ $blogStats['comments'] }} 条</li>
|
||
<li>标签 {{ $blogStats['tags'] }} 个</li>
|
||
</ul>
|
||
</section>
|
||
@stack('theme:sidebar_bottom')
|
||
</aside>
|