Files
laralog/resources/views/partials/sidebar.blade.php
T
ak 8f1ff6e3f9 feat: 外链中转 /go——点击统计 + 拦截 + 隐藏真实链接
- redirects 表 + UrlRedirector:go_url() 站外链接改写为 /go/{hash}(确定性 hash、同 URL 复用、并发安全、缓存)
- /go/{hash} 302 跳转 + 点击计数 + 最后点击时间;停用状态 410(二次拦截);后台「外链中转」资源可查看点击量/启停/删除
- 接入点:正文外链(渲染器统一改写)、评论正文自动链接(comment_body)、评论作者网址、友链(侧边栏+友链页);站内/相对/mailto/tel/锚点不中转
- 测试 6 个(改写/计数/拦截/复用/渲染/评论正文);README 补充
2026-08-13 01:28:10 +08:00

89 lines
3.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<aside class="sidebar">
@stack('theme:sidebar_top')
<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="{{ go_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 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>
@stack('theme:sidebar_bottom')