feat: restore sablog browse modes and clean imported HTML
Build and Deploy / verify (push) Successful in 40s
Build and Deploy / deploy (push) Successful in 36s

Keep the public site readable after import (nbsp, highlighter, wrapping code, compact pager) and finish the admin extras already in this tree: sticky levels, preview, page cache, and live llms.txt.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
gouki
2026-09-18 21:33:02 +00:00
co-authored by Cursor
parent 469160dc3f
commit ae47447062
98 changed files with 8618 additions and 901 deletions
+16 -8
View File
@@ -10,10 +10,14 @@ use App\Blog\Controllers\FeedController;
use App\Blog\Controllers\HomeController;
use App\Blog\Controllers\LegacyController;
use App\Blog\Controllers\LinkController;
use App\Blog\Controllers\LlmsController;
use App\Blog\Controllers\PostController;
use App\Blog\Controllers\SearchController;
use App\Blog\Controllers\TagController;
use App\Blog\Controllers\ThemeAssetController;
use App\Models\Category;
use App\Models\Post;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Route;
/*
@@ -33,18 +37,22 @@ Route::get('/', function () {
// sablog 首页分页格式:/index-{page}.shtml
Route::get('/index-{page}.shtml', function (string $page) {
\Illuminate\Pagination\Paginator::currentPageResolver(fn () => max(1, (int) $page));
Paginator::currentPageResolver(fn () => max(1, (int) $page));
return app(HomeController::class)->index();
})->whereNumber('page');
Route::get('/posts/{slug}.md', [LlmsController::class, 'postMarkdown'])
->where('slug', '[^/]+')
->name('geo.post.markdown');
Route::get('/posts/{slug}.shtml', function (string $slug) {
$post = \App\Models\Post::query()->where('slug', $slug)->orWhere('id', (int) $slug)->first();
$post = Post::query()->where('slug', $slug)->orWhere('id', (int) $slug)->first();
return $post ? redirect()->route('posts.show', $post->id, 301) : abort(404);
})->where('slug', '[^/]+');
Route::get('/posts/{slug}', function (string $slug) {
$post = \App\Models\Post::query()->where('slug', $slug)->orWhere('id', (int) $slug)->first();
$post = Post::query()->where('slug', $slug)->orWhere('id', (int) $slug)->first();
return $post ? redirect()->route('posts.show', $post->id, 301) : abort(404);
})->where('slug', '[^/]+');
@@ -55,16 +63,15 @@ Route::get('/show-{id}-{page}.shtml', [PostController::class, 'show'])->whereNum
Route::post('/posts/{post}/comments', [CommentController::class, 'store'])->name('comments.store');
// 浏览量统计(独立端点,避开整页缓存,保证实时)
Route::get('/track-view/{post}', fn (\App\Models\Post $post) => response($post->increment('views') ? '' : '', 204))->name('track-view');
Route::get('/track-view/{post}', fn (Post $post) => response($post->increment('views') ? '' : '', 204))->name('track-view');
Route::get('/category/{slug}.shtml', function (string $slug) {
$category = \App\Models\Category::query()->where('slug', $slug)->orWhere('id', (int) $slug)->first();
$category = Category::query()->where('slug', $slug)->orWhere('id', (int) $slug)->first();
return $category ? redirect()->route('category.show', $category->id, 301) : abort(404);
})->where('slug', '[^/]+');
Route::get('/category/{slug}', function (string $slug) {
$category = \App\Models\Category::query()->where('slug', $slug)->orWhere('id', (int) $slug)->first();
$category = Category::query()->where('slug', $slug)->orWhere('id', (int) $slug)->first();
return $category ? redirect()->route('category.show', $category->id, 301) : abort(404);
})->where('slug', '[^/]+');
@@ -120,7 +127,7 @@ Route::get('/profile', fn () => redirect()->route('profile', [], 301))->middlewa
/*
|--------------------------------------------------------------------------
| 稳定路径:RSS / Sitemap / Robots
| 稳定路径:RSS / Sitemap / Robots / llms.txt
|--------------------------------------------------------------------------
*/
@@ -128,6 +135,7 @@ Route::get('/rss.xml', [FeedController::class, 'rss'])->name('feed.rss');
Route::get('/rss.php', [FeedController::class, 'rss']);
Route::get('/sitemap.xml', [FeedController::class, 'sitemap'])->name('feed.sitemap');
Route::get('/robots.txt', [FeedController::class, 'robots'])->name('robots');
Route::get('/llms.txt', [LlmsController::class, 'index'])->name('feed.llms');
/*
|--------------------------------------------------------------------------