Merge branch 'main' of gitea.neatcn.com:gouki/laralog
Build and Deploy / verify (push) Successful in 34s
Build and Deploy / deploy (push) Successful in 40s

Keep media-library covers while adopting sablog /show-{id}.shtml canonical URLs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
gouki
2026-09-16 19:06:42 +00:00
co-authored by Cursor
23 changed files with 116 additions and 73 deletions
+6 -6
View File
@@ -1,18 +1,18 @@
<article class="post-card {{ $post->is_sticky ? 'sticky' : '' }}">
@if($url = $post->coverImageUrl())
<a href="{{ route('posts.show', $post->slug ?: $post->id) }}" class="post-cover">
@if($url = $post->coverImageUrl())
<a href="{{ route('posts.show', $post->id) }}" class="post-cover">
<img src="{{ $url }}" 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>
<a href="{{ route('posts.show', $post->id) }}">{{ $post->title }}</a>
</h2>
<div class="post-meta">
<time datetime="{{ $post->published_at->toIso8601String() }}">{{ $post->published_at->format(blog_setting('normaltime', '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>
<a href="{{ route('category.show', $post->category->id) }}">{{ $post->category->name }}</a>
@endif
<span>· 阅读 {{ $post->views }}</span>
<span>· 评论 {{ $post->comment_count }}</span>
@@ -21,9 +21,9 @@
{{ 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>
<a href="{{ route('posts.show', $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>
<a href="{{ route('tags.show', $tag->name) }}" class="tag-link">#{{ $tag->name }}</a>
@endforeach
</div>
</article>
+4 -4
View File
@@ -5,7 +5,7 @@
<ul class="widget-list">
@forelse($categories as $category)
<li>
<a href="{{ route('category.show', $category->slug ?: $category->id) }}">{{ $category->name }}</a>
<a href="{{ route('category.show', $category->id) }}">{{ $category->name }}</a>
<span class="count">({{ $category->post_count }})</span>
</li>
@empty
@@ -18,7 +18,7 @@
<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>
<li><a href="{{ route('posts.show', $post->id) }}">{{ $post->title }}</a></li>
@empty
<li>暂无文章</li>
@endforelse
@@ -30,7 +30,7 @@
<ul class="widget-list">
@forelse($recentComments as $comment)
<li>
<a href="{{ route('posts.show', $comment->post->slug ?: $comment->post->id) }}#comment-{{ $comment->id }}">
<a href="{{ route('posts.show', $comment->post->id) }}#comment-{{ $comment->id }}">
{{ $comment->author_name }}:{{ Str::limit(strip_tags($comment->content), 30) }}
</a>
</li>
@@ -44,7 +44,7 @@
<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>
<a href="{{ route('tags.show', $tag->name) }}" class="tag-link">{{ $tag->name }}</a>
@empty
<span>暂无标签</span>
@endforelse