SEO & Metadata (JSONB)
In Pyxis CMS, search engine optimization (SEO) data is managed through a single, flexible JSONB column. This approach prioritizes extensibility without the need for constant database schema changes.
Why JSONB for SEO?
Section titled “Why JSONB for SEO?”Traditional CMS architectures often use separate columns for every meta tag (e.g., seo_title, seo_description). Pyxis CMS replaces this with a structured JSON object for several reasons:
- Schema Stability: Adding a new meta tag (like
canonical_urlortwitter:card) only requires a change in the Admin Panel UI, not a database migration. - PostgreSQL Performance: Using the
jsonbtype ensures that data is stored in a binary format, allowing for efficient retrieval and indexing if needed. - Headless Ready: The Next.js frontend receives a clean, nested object, making it easy to map directly to
<meta>tags in the document head.
Implementation Details
Section titled “Implementation Details”Laravel Model Casting
Section titled “Laravel Model Casting”To make JSON data easy to work with in PHP, the Page model uses Attribute Casting:
protected $casts = [ 'seo' => 'array',];Filament Integration
Section titled “Filament Integration”In the admin panel, we utilize dot notation to map form fields directly to keys within the JSON object. This creates a seamless bridge between the UI and the database:
- seo.title maps to the title key.
- seo.description
Example Data Structure
Section titled “Example Data Structure”A typical SEO entry in the database looks like this:
{ "title": "Welcome to Pyxis CMS", "description": "The modern headless CMS built for developers.", "og_image": "pages/seo/cover.jpg"}