diff --git a/server/admin-api/content-types/redirect/schema.json b/server/admin-api/content-types/redirect/schema.json new file mode 100644 index 00000000..217db291 --- /dev/null +++ b/server/admin-api/content-types/redirect/schema.json @@ -0,0 +1,44 @@ +{ + "kind": "collectionType", + "collectionName": "redirects", + "info": { + "singularName": "redirect", + "pluralName": "redirects", + "displayName": "Redirect" + }, + "options": { + "draftAndPublish": false, + "comment": "" + }, + "pluginOptions": { + "content-manager": { + "visible": false + }, + "content-type-builder": { + "visible": false + } + }, + "attributes": { + "from_path": { + "type": "relation", + "relation": "oneToOne", + "target": "plugin::url-alias.path", + "required": true, + "unique": true + }, + "to_path": { + "type": "relation", + "relation": "oneToOne", + "target": "plugin::url-alias.path" + }, + "to_url": { + "type": "string" + }, + "redirect_type": { + "type": "enumeration", + "enum": ["permanent", "temporary"], + "required": true, + "default": "permanent" + } + } +} diff --git a/server/index.ts b/server/index.ts index 46bf9ad6..30d0d542 100644 --- a/server/index.ts +++ b/server/index.ts @@ -7,6 +7,7 @@ import adminApiRegister from "./admin-api/register"; import adminApiBootstrap from "./admin-api/bootstrap"; import adminApiPathSchema from "./admin-api/content-types/path/schema.json"; import adminApiPatternSchema from "./admin-api/content-types/pattern/schema.json"; +import adminApiRedirectSchema from "./admin-api/content-types/redirect/schema.json"; import adminApiPathController from "./admin-api/controllers/path"; import adminApiPatternController from "./admin-api/controllers/pattern"; import adminApiInfoController from "./admin-api/controllers/info"; @@ -39,6 +40,9 @@ export default { pattern: { schema: adminApiPatternSchema, }, + redirect: { + schema: adminApiRedirectSchema, + }, }, routes: { admin: {