refactor(routes): canonical URLs now match sablog format exactly
- /show-{id}.shtml (comments page: /show-{id}-{page}.shtml)
- /category-{cid}.shtml / /category-{cid}-{page}.shtml
- /archives-{YYYYMM}.shtml / /archives-{YYYYMM}-{page}.shtml
- /tag/{name}, /tagslist.shtml, /index-{page}.shtml
- slug 时代的 /posts/{slug} 等旧格式全部 301 到 sablog 格式
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<h3>分类</h3>
|
||||
<ul>
|
||||
@forelse($categories as $category)
|
||||
<li><a href="{{ route('category.show', $category->slug ?: $category->id) }}">{{ $category->name }}</a> ({{ $category->post_count }})</li>
|
||||
<li><a href="{{ route('category.show', $category->id) }}">{{ $category->name }}</a> ({{ $category->post_count }})</li>
|
||||
@empty
|
||||
<li>暂无分类</li>
|
||||
@endforelse
|
||||
@@ -22,7 +22,7 @@
|
||||
<h3>最新文章</h3>
|
||||
<ul>
|
||||
@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
|
||||
@@ -33,7 +33,7 @@
|
||||
<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>
|
||||
<li><a href="{{ route('posts.show', $comment->post->id) }}#comment-{{ $comment->id }}">{{ $comment->author_name }}:{{ Str::limit(strip_tags($comment->content), 20) }}</a></li>
|
||||
@empty
|
||||
<li>暂无评论</li>
|
||||
@endforelse
|
||||
@@ -44,7 +44,7 @@
|
||||
<h3>标签</h3>
|
||||
<p class="tagcloud">
|
||||
@forelse($hotTags as $tag)
|
||||
<a href="{{ route('tags.show', $tag->slug ?: $tag->name) }}">{{ $tag->name }}</a>
|
||||
<a href="{{ route('tags.show', $tag->name) }}">{{ $tag->name }}</a>
|
||||
@empty
|
||||
暂无标签
|
||||
@endforelse
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<time datetime="{{ $post->published_at->toIso8601String() }}">{{ $post->published_at->format(blog_setting('normaltime', '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>
|
||||
<span>· <a href="{{ route('category.show', $post->category->id) }}">{{ $post->category->name }}</a></span>
|
||||
@endif
|
||||
<span>· 阅读 {{ $post->views }}</span>
|
||||
</div>
|
||||
@@ -52,7 +52,7 @@
|
||||
@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>
|
||||
<a href="{{ route('tags.show', $tag->name) }}" class="tag-link">#{{ $tag->name }}</a>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
||||
Reference in New Issue
Block a user