Strapi 版本:3.6.8
操作系统:big sur 11.6
数据库:postgresql
节点版本:14.17.5
NPM 版本:8.0.0
纱线版本:1.22.11
我有一个帖子集合类型,与以下集合类型具有多对多关系:-tags -categories 和一对多关系:-users(来自:users-permissions)
假设我想为用户和标签创建页面,它们都显示各自的帖子。问题是,类别仅显示为 id 而不是它们的指定名称。有什么办法可以解决这种情况?
附加信息:
类别.settings.json:
{
"kind": "collectionType",
"collectionName": "categories",
"info": {
"name": "Categories"
},
"options": {
"increments": true,
"timestamps": true,
"draftAndPublish": false
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"Name": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string",
"unique": true,
"required": true
},
"slug": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string",
"required": true,
"unique": true
},
"posts": {
"via": "categories",
"collection": "post"
}
}
}
post.settings.json:
{
"kind": "collectionType",
"collectionName": "posts",
"info": {
"name": "Post",
"description": ""
},
"options": {
"increments": true,
"timestamps": true,
"draftAndPublish": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"title": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"thumbnail": {
"model": "file",
"via": "related",
"allowedTypes": [
"images"
],
"plugin": "upload",
"required": false,
"pluginOptions": {
"i18n": {
"localized": false
}
}
},
"wide_thumbnail": {
"model": "file",
"via": "related",
"allowedTypes": [
"images"
],
"plugin": "upload",
"required": false,
"pluginOptions": {
"i18n": {
"localized": true
}
}
},
"user": {
"via": "posts",
"plugin": "users-permissions",
"model": "user"
},
"slug": {
"pluginOptions": {},
"type": "uid",
"targetField": "title"
},
"publication_date": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "date"
},
"tags": {
"targetColumnName": "",
"via": "posts",
"collection": "tag",
"dominant": true
},
"comments": {
"plugin": "comments",
"collection": "comment"
},
"youtube": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"season": {
"model": "season",
"via": "posts"
},
"isFeature": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "boolean"
},
"content": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "richtext",
"required": true
},
"spotify": {
"pluginOptions": {
"i18n": {
"localized": false
}
},
"type": "string"
},
"description": {
"pluginOptions": {
"i18n": {
"localized": true
}
},
"type": "string"
},
"categories": {
"via": "posts",
"collection": "categories"
}
}
}
标签.settings.json:
{
"kind": "collectionType",
"collectionName": "tags",
"info": {
"name": "tag",
"description": ""
},
"options": {
"increments": true,
"timestamps": true,
"draftAndPublish": false
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"name": {
"pluginOptions": {
"i18n": {
"localized": false
}
},
"type": "string"
},
"posts": {
"via": "tags",
"collection": "post"
},
"slug": {
"type": "uid",
"targetField": "name"
}
}
}
感谢您的时间。