How to override Strapi's core entity-validator?

You can create a collection type called URLs, there you will have Homepage, Contacts, Categories, Tags, etc.
For the Page you should keep the default slug field. (ex: my-test-page)

Then you add your Page into the relation with an item from URLs, for example, let’s assume we created a new page with slug my-test-page and created a relation with Homepage from URLS.

An example response for the Page, after adding the relation with Homepage

{
    "id": "1",
    "page_title": "My test page",
    "page_body": "some text here",
    "page_slug":"my-test-page",
    "urls":{
        "url_name":"Homepage",
        "url_slug":"homepage"
    }
}

Now you get the page_slug and the urls.url_slug and concatenate them:

let URL = `/${data.page_slug}/${data.urls.url_slug}`; // result: /homepage/my-test-page
1 Like