Skip to content

Slug Resolution

Slug resolution in Pyxis CMS handles dynamic tree structures and flexible homepage definitions.

When Next.js queries the API, it sends the full path as a single string (e.g., company/about-us/team).

The system breaks the path into segments to identify the target record:

  • Regular Pages: Lookup based on the last slug segment with a published status filter.
  • Homepage (Root): If the request is for the / path, the system looks for the record designated as the Homepage in the global settings, rather than searching for a “home” slug.

A critical step for SEO. The system ensures the found page actually resides at the requested hierarchy.

We compare the model’s computed full_url with the slug sent in the request:

  • If paths match -> Success (200 OK).
  • If there is a mismatch (e.g., accessing a child page via an incomplete path) -> Error (404 Not Found).

ScenarioAPI ResultReason
Slug does not exist404No database record found.
Hierarchy Error404Path mismatch (e.g., incorrect parent path).
Missing Homepage404No page has been selected as the Homepage in the admin panel.