This commit is contained in:
2026-09-08 23:34:42 +02:00
parent 91b61caa37
commit 754b84e5f6
18 changed files with 304 additions and 72 deletions
@@ -11,31 +11,41 @@
"draftAndPublish": true,
"populateCreatorFields": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"title": {
"type": "string",
"required": true,
"maxLength": 160
"maxLength": 160,
"pluginOptions": { "i18n": { "localized": true } }
},
"slug": {
"type": "uid",
"targetField": "title",
"required": true
"required": true,
"pluginOptions": { "i18n": { "localized": false } }
},
"content": {
"type": "richtext",
"required": true
"required": true,
"pluginOptions": { "i18n": { "localized": true } }
},
"cover": {
"type": "media",
"multiple": false,
"allowedTypes": ["images"]
"allowedTypes": ["images"],
"pluginOptions": { "i18n": { "localized": false } }
},
"category": {
"type": "relation",
"relation": "manyToOne",
"target": "api::category.category",
"inversedBy": "articles"
"inversedBy": "articles",
"pluginOptions": { "i18n": { "localized": false } }
}
}
}
@@ -10,22 +10,30 @@
"options": {
"draftAndPublish": false
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"name": {
"type": "string",
"required": true,
"unique": true
"unique": true,
"pluginOptions": { "i18n": { "localized": true } }
},
"slug": {
"type": "uid",
"targetField": "name",
"required": true
"required": true,
"pluginOptions": { "i18n": { "localized": false } }
},
"articles": {
"type": "relation",
"relation": "oneToMany",
"target": "api::article.article",
"mappedBy": "category"
"mappedBy": "category",
"pluginOptions": { "i18n": { "localized": false } }
}
}
}
+14
View File
@@ -45,11 +45,25 @@ async function disablePublicSignUp(strapi: Core.Strapi) {
}
}
/**
* The site content is authored in Italian and English. Strapi ships with only
* the default `it` locale, so the `en` locale is created here if missing.
*/
async function ensureEnglishLocale(strapi: Core.Strapi) {
const locales = strapi.plugin('i18n').service('locales');
const existing = await locales.find({ where: { code: 'en' } });
if (existing.length === 0) {
await locales.create({ code: 'en', name: 'English (en)', isDefault: false });
}
}
export default {
register() {},
async bootstrap({ strapi }: { strapi: Core.Strapi }) {
await grantPublicReadAccess(strapi);
await disablePublicSignUp(strapi);
await ensureEnglishLocale(strapi);
},
};