Documento de Evento (event)
El tipo event representa un evento presencial de Asama Yoga: una inauguración, un taller o cualquier encuentro con fecha, ubicación e itinerario. Reemplaza el archivo apps/web/data/event.json como fuente de datos oficial.
Cuándo usar este tipo
Usa event para cada evento individual. Si necesitas una página que los liste todos (ej: /eventos), crea un documento indexPage con collectionType: "event".
Grupos de campos
El documento tiene cuatro pestañas en el Studio:
| Pestaña | Propósito |
|---|---|
| Contenido | Título, imagen, textos, estado |
| Detalles | Fecha, precio, itinerario, URL de reservación |
| Ubicación | Lugar, ciudad, estado, mapas |
| SEO | Metadatos de búsqueda |
Campos disponibles
Contenido
| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
title | string | Sí | Nombre del evento. Ej: Inauguración Asama Yoga Hermosillo |
slug | slug | Sí | URL del evento. Ej: inauguracion-asamayoga-hermosillo → /eventos/inauguracion-asamayoga-hermosillo |
eyebrow | string | No | Etiqueta sobre el título. Ej: EVENTO INAUGURAL |
description | text | No | Descripción corta (para cards y previews) |
longDescription | text | No | Descripción completa del evento |
imagePublicId | string | No | Public ID de Cloudinary. Ej: SONORA_eofbow |
imageAlt | string | No | Texto alternativo de la imagen |
comingSoon | boolean | No | Si está activo, el frontend oculta los detalles y muestra “Próximamente”. Default: false |
Detalles
| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
eventDate | datetime | No | Fecha y hora exacta del evento (ISO 8601). Usada para filtrar eventos pasados y ordenar por proximidad. Sin este campo el evento no aparece en el listado. |
date | string | No | Fecha en texto para mostrar en la UI. Ej: 17 de mayo, 11:00 am |
dateShort | string | No | Versión compacta para la UI. Ej: MAY\n17 (mes y día separados por salto de línea) |
timeRange | string | No | Horario completo. Ej: 11:00 am - 1:10 pm |
price | string | No | Precio formateado. Ej: MXN $300.00 |
priceAmount | number | No | Solo el número para lógica de pago. Ej: 300 |
reservationUrl | string | No | URL del botón de reservación. Ej: #reservar |
itinerary | array | No | Lista de items con time y activity |
Ubicación
| Campo | Tipo | Requerido | Descripción |
|---|---|---|---|
location | string | No | Nombre del lugar. Ej: KOVA Eventos |
city | string | No | Ciudad. Ej: Hermosillo |
stateOrProvince | string | No | Estado. Ej: Sonora |
mapsEmbedUrl | url | No | URL del iframe de Google Maps |
mapsDirectionsUrl | url | No | URL de indicaciones de Google Maps |
Código fuente
// schemas/documents/event.ts
import { defineArrayMember, defineField, defineType } from "sanity"
export const eventDocument = defineType({
name: "event",
title: "Eventos",
type: "document",
groups: [
{ name: "content", title: "Contenido", default: true },
{ name: "details", title: "Detalles" },
{ name: "location", title: "Ubicación" },
{ name: "seo", title: "SEO" },
],
fields: [
// Contenido
defineField({ name: "title", title: "Título", type: "string", ... }),
defineField({ name: "slug", type: "slug", options: { source: "title" }, ... }),
defineField({ name: "eyebrow", type: "string", ... }),
defineField({ name: "description", type: "text", rows: 3, ... }),
defineField({ name: "longDescription", type: "text", rows: 6, ... }),
defineField({ name: "imagePublicId", type: "string", ... }),
defineField({ name: "imageAlt", type: "string", ... }),
defineField({ name: "comingSoon", type: "boolean", initialValue: false, ... }),
// Detalles
defineField({ name: "date", type: "string", ... }),
defineField({ name: "timeRange", type: "string", ... }),
defineField({ name: "price", type: "string", ... }),
defineField({ name: "priceAmount", type: "number", ... }),
defineField({ name: "reservationUrl", type: "string", ... }),
defineField({ name: "itinerary", type: "array", of: [itineraryItem], ... }),
// Ubicación
defineField({ name: "location", type: "string", ... }),
defineField({ name: "city", type: "string", ... }),
defineField({ name: "stateOrProvince", type: "string", ... }),
defineField({ name: "mapsEmbedUrl", type: "url", ... }),
defineField({ name: "mapsDirectionsUrl", type: "url", ... }),
// SEO
defineField({ name: "seo", type: "seo", ... }),
],
})Crear un evento en el Studio
- En el Studio, abre el tipo Eventos en la barra lateral
- Haz clic en Nuevo documento
- Ingresa el Título y genera el Slug
- Si el evento aún no tiene detalles confirmados, activa Próximamente
- Completa la pestaña Detalles con fecha, precio e itinerario
- Completa la pestaña Ubicación si el lugar ya está confirmado
- Publica el documento
Consulta GROQ para el front-end
// Listar eventos futuros ordenados por proximidad (eventos sin fecha van al final)
*[_type == "event" && (eventDate >= now() || !defined(eventDate))] | order(eventDate asc) {
slug,
eyebrow,
title,
description,
longDescription,
imagePublicId,
imageAlt,
comingSoon,
date,
timeRange,
price,
priceAmount,
reservationUrl,
itinerary[] { time, activity },
location,
city,
stateOrProvince,
mapsEmbedUrl,
mapsDirectionsUrl,
seo { metaTitle, metaDescription, ogImage, noIndex }
}// Obtener un evento por slug
*[_type == "event" && slug.current == $slug][0] {
// mismos campos de arriba
}Página índice de eventos
Para crear la página /eventos que lista todos los eventos, crea un documento indexPage con collectionType: "event". El frontend es responsable de consultar los documentos event correspondientes usando GROQ.
Last updated on