fix(tags): use crc32-fallback slugger for Chinese tag names (HasSlug was blanking slugs)
This commit is contained in:
@@ -344,8 +344,8 @@ class SablogImport extends Command
|
||||
// 必须用 findFromString(内部按 locale 查询 JSON 键),否则每次导入都重复建标签
|
||||
$tag = Tag::findFromString($tagName, 'post');
|
||||
if (! $tag) {
|
||||
// slug 由 spatie/tags 的 HasSlug 钩子用 tags.slugger(=SlugGenerator::slug)自动生成
|
||||
$tag = new Tag(['name' => $tagName, 'type' => 'post']);
|
||||
$tag->slug = SlugGenerator::make($tagName, 'tags', 'slug', fallback: 'tag-'.crc32($tagName));
|
||||
$tag->save();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user