Headless

Page Methods

Page methods for headless sites.

i18nMeta()

The i18nMeta() method returns an array including the title and URI for the current page in all available languages. This is useful for the frontend application to build a language switcher.

Given a KQL query like this:

import type { KirbyQuerySchema } from "kirby-types";

export const pageQuery: KirbyQuerySchema = {
  query: 'page("home")',
  select: {
    title: true,
    i18nMeta: true,
  },
};

The JSON response from the KQL API might look like this:

{
  "code": 200,
  "status": "OK",
  "result": {
    "title": "Home",
    "i18nMeta": {
      "en": {
        "title": "Home",
        "uri": "home"
      },
      "de": {
        "title": "Startseite",
        "uri": "home"
      }
    }
  }
}