feat(seo): 사이트맵 증분 저장소 + 리소스 리스너 재배선
사이트맵을 리소스 단위로 영속화(sitemap_urls)해 진정한 증분 갱신과 도메인 재쿼리 없는 파일 재작성을 구현했다. 리소스 공개/비공개/삭제 시 해당 항목만 색인이 갱신되고, 관리자=full·스케줄러=auto·리소스 변경=증분으로 동작한다. - sitemap_urls 마이그레이션 + SitemapUrl 모델. loc(2048) 를 unique 에 직접 넣으면 InnoDB 키 길이를 초과하므로 loc_hash(sha256) 컬럼을 identity 로 사용 - SitemapUrlRepository(멱등 upsert / remove / 스트리밍) + SitemapIndexer (+ 제3자용 sitemap.index.collect_for_resource 필터 훅) - 4 리스너 재배선: 공개→색인 / 비공개·삭제→색인 해제 + 재생성 잡 디바운스 디스패치. 3 기여자가 resource_type/resource_id 를 함께 emit 해 전체·증분 identity 를 일치 - 재생성 모드를 SitemapGenerationMode Backed Enum 으로 통일(Command→Job→Manager) - seo:generate-sitemap 에 --rebuild / --mode 옵션 추가
This commit is contained in:
1 parent
1a6fca0d6b
commit
1629684156
34 files changed
+2027
-23
No files matched your search
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* 사이트맵 URL 영속 모델
|
||||
*
|
||||
* sitemap_urls 테이블의 한 행 = 사이트맵에 노출되는 하나의 리소스 URL.
|
||||
* 리소스 단위 증분 갱신(공개=upsert / 비공개=remove)과 도메인 재쿼리 없는
|
||||
* 파일 재작성의 저장소입니다. 데이터 접근은 SitemapUrlRepository 를 경유합니다.
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $resource_type
|
||||
* @property string|null $resource_id
|
||||
* @property string $loc
|
||||
* @property string $loc_hash
|
||||
* @property Carbon|null $lastmod
|
||||
* @property string|null $changefreq
|
||||
* @property float|null $priority
|
||||
* @property string $contributor
|
||||
* @property bool $is_visible
|
||||
*/
|
||||
class SitemapUrl extends Model
|
||||
{
|
||||
/**
|
||||
* @var string 테이블명
|
||||
*/
|
||||
protected $table = 'sitemap_urls';
|
||||
|
||||
/**
|
||||
* @var list<string> 대량 할당 가능 컬럼
|
||||
*/
|
||||
protected $fillable = [
|
||||
'resource_type',
|
||||
'resource_id',
|
||||
'loc',
|
||||
'loc_hash',
|
||||
'lastmod',
|
||||
'changefreq',
|
||||
'priority',
|
||||
'contributor',
|
||||
'is_visible',
|
||||
];
|
||||
|
||||
/**
|
||||
* 속성 캐스팅을 반환합니다.
|
||||
*
|
||||
* @return array<string, string> 캐스팅 맵
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'lastmod' => 'datetime',
|
||||
'priority' => 'float',
|
||||
'is_visible' => 'boolean',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user