backend:
  name: git-gateway
  branch: main

local_backend: true

media_folder: "public/uploads"
public_folder: "/uploads"

publish_mode: editorial_workflow

i18n:
  structure: multiple_folders
  locales: ["es"]
  default_locale: "es"

collections:
  - name: "programs"
    label: "Programas"
    folder: "src/content/programs"
    create: true
    extension: "md"
    slug: "{{slug}}"
    fields:
      - { label: "Título", name: "title", widget: "string" }
      - { label: "Fecha", name: "date", widget: "datetime" }
      - { label: "Descripción", name: "description", widget: "string" }
      - { label: "Imagen de portada", name: "image", widget: "image" }
      - { label: "Contenido", name: "body", widget: "markdown" }

  - name: "articles"
    label: "Artículos"
    folder: "src/content/articles"
    create: true
    extension: "md"
    slug: "{{slug}}"
    fields:
      - { label: "Título", name: "title", widget: "string" }
      - { label: "Fecha", name: "date", widget: "datetime" }
      - { label: "Descripción", name: "description", widget: "string" }
      - { label: "Imagen de portada", name: "image", widget: "image" }
      - { label: "Contenido", name: "body", widget: "markdown" }

  # 1) Colección de tags (solo título)
  - name: "gallery_tags"
    label: "Tags de galería"
    folder: "src/content/tags"
    create: true
    extension: "json"
    slug: "{{slug}}"
    fields:
      - { label: "Nombre del tag", name: "title", widget: "string" }

  # 2) Galería que referencia tags (JSON fijo)
  - name: "galeria"
    label: "Galería de fotos"
    files:
      - name: "index"
        label: "Galería"
        file: "src/content/galeria/index.json"
        format: "json"
        fields:
          - { name: "descripcion", label: "Descripción", widget: "string" }
          - name: "fotos"
            label: "Fotos"
            widget: "list"
            fields:
              - {
                  label: "Título",
                  name: "title",
                  widget: "string",
                } # <- Faltaba
              - label: "Foto"
                name: "src"
                widget: "image"
                media_folder: "/public/gallery" # <- relativo al repo
                public_folder: "/gallery" # <- servido en prod
              - label: "Tags"
                name: "tags"
                widget: "relation"
                collection: "gallery_tags"
                search_fields: ["title"]
                value_field: "{{slug}}"
                display_fields: ["title"]
                multiple: true
