Slug Resolution
Slug resolution in Pyxis CMS handles dynamic tree structures and flexible homepage definitions.
Mapping Mechanism
Section titled “Mapping Mechanism”When Next.js queries the API, it sends the full path as a single string (e.g., company/about-us/team).
1. Extraction & Identification
Section titled “1. Extraction & Identification”The system breaks the path into segments to identify the target record:
- Regular Pages: Lookup based on the last
slugsegment with apublishedstatus 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.
2. Path Integrity Validation
Section titled “2. Path Integrity Validation”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).
Response Codes
Section titled “Response Codes”| Scenario | API Result | Reason |
|---|---|---|
| Slug does not exist | 404 | No database record found. |
| Hierarchy Error | 404 | Path mismatch (e.g., incorrect parent path). |
| Missing Homepage | 404 | No page has been selected as the Homepage in the admin panel. |