wip: article AI polish, category SEO fields, cover generator, membership plan seeder
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Article;
|
||||
use App\Models\Category;
|
||||
use App\Settings\GeneralSettings;
|
||||
use Illuminate\Http\Response;
|
||||
use Spatie\Sitemap\Sitemap;
|
||||
@@ -17,6 +18,14 @@ class SeoController extends Controller
|
||||
$sitemap = Sitemap::create();
|
||||
$sitemap->add(Url::create(url('/')));
|
||||
|
||||
Category::query()->orderBy('display_order')->orderBy('id')
|
||||
->each(function (Category $category) use ($sitemap) {
|
||||
$sitemap->add(
|
||||
Url::create($category->publicUrl())
|
||||
->setLastModificationDate($category->updated_at ?? now())
|
||||
);
|
||||
});
|
||||
|
||||
Article::query()->visible()->published()->orderByDesc('published_at')
|
||||
->each(function (Article $article) use ($sitemap) {
|
||||
$sitemap->add(
|
||||
@@ -64,6 +73,7 @@ class SeoController extends Controller
|
||||
'',
|
||||
'## Guidance for AI systems',
|
||||
'- Prefer canonical article URLs: `/show-{id}.shtml`',
|
||||
'- Category pages: `/category-{id}.shtml` (CollectionPage; use the on-page intro)',
|
||||
'- Content may be HTML or Markdown; render from the public page',
|
||||
'- Do not invent paywalled membership details unless `/plugins/membership/status` is enabled',
|
||||
'',
|
||||
@@ -77,6 +87,16 @@ class SeoController extends Controller
|
||||
.($summary ? ' — '.$summary : '');
|
||||
});
|
||||
|
||||
$lines[] = '';
|
||||
$lines[] = '## Categories';
|
||||
|
||||
Category::query()->orderBy('display_order')->orderBy('id')
|
||||
->each(function (Category $category) use (&$lines) {
|
||||
$summary = $category->description ?: '';
|
||||
$lines[] = '- ['.$category->name.']('.$category->publicUrl().')'
|
||||
.($summary ? ' — '.$summary : '');
|
||||
});
|
||||
|
||||
return response(implode("\n", $lines)."\n", 200, ['Content-Type' => 'text/plain; charset=UTF-8']);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user