feat: initialize TinaCMS configuration with news and documentaries collections

This commit is contained in:
Esteban 2026-05-10 11:06:52 -05:00
parent 75132c932c
commit 36c383a052
15 changed files with 167 additions and 303 deletions

View File

@ -1,120 +0,0 @@
---
import { YouTube } from 'astro-embed';
import MainLayout from "../../layouts/MainLayout.astro";
import Header from "../../components/Header.astro";
import CarouselSection from "../../components/section/CarouselSection.astro";
import { Image } from "@unpic/astro";
import { getCollection, render } from "astro:content";
import TitleSection from "../../components/section/TitleSection.astro";
import FooterSection from '../../components/section/FooterSection.astro';
import { getLocalizedRoute } from '@/i18n';
export const prerender = true;
// 1. Generate a new path for every collection entry
export async function getStaticPaths() {
const posts = await getCollection("news");
return posts.map((post) => ({
params: {
id: post.id,
news_slug: getLocalizedRoute('news', post.data.locale)
},
props: { post },
}));
}
const { news_slug } = Astro.params;
const { post } = Astro.props;
const { Content } = await render(post);
console.log("astro site", Astro.site);
const baseUrl = Astro.site ?? "https://mk8nrc8p-4321.brs.devtunnels.ms";
const pageUrl = new URL(`/${post.data.locale}/${news_slug}/${post.id}`, baseUrl).toString();
const imageUrl = post.data.thumbnail ? new URL(post.data.thumbnail, baseUrl).toString() : null;
const localeDate = new Intl.DateTimeFormat(post.data.locale || 'es', { year: 'numeric', month: 'long', day: 'numeric' }).format(post.data.date);
const y = post.data.date.getFullYear();
const m = String(post.data.date.getMonth() + 1).padStart(2, '0');
const d = String(post.data.date.getDate()).padStart(2, '0');
const dateISO = `${y}-${m}-${d}`;
---
<style>
.content h2 {
font-size: 42px !important;
background-color: red;
}
</style>
<MainLayout
title={post.data.title}
date={post.data.date}
>
<Fragment slot="head">
<!-- Título -->
<title>{post.data.title}</title>
<!-- Descripción SEO -->
<meta name="description" content={`${post.data.title} - ${post.data.city ?? ""} ${post.data.country ?? ""}`} />
<!-- Open Graph (Facebook / WhatsApp / LinkedIn) -->
<meta property="og:type" content="article" />
<meta property="og:title" content={post.data.title} />
<meta property="og:description" content={`${post.data.title} - ${post.data.city ?? ""} ${post.data.country ?? ""}`} />
<meta property="og:url" content={pageUrl} />
{post.data.gallery && post.data.gallery.length > 0 && post.data.gallery[0].image && (
<>
<meta property="og:image" content={new URL(post.data.gallery[0].image.src, baseUrl)} />
<meta property="og:image:width" />
<meta property="og:image:height" />
<meta property="og:image:type" content={`image/${post.data.gallery[0].image.format}`} />
</>
)}
<meta property="article:published_time" content={dateISO} />
</Fragment>
<script type="application/ld+json" set:html={JSON.stringify({
"@context": "https://schema.org",
"@type": "NewsArticle",
"headline": post.data.title,
"datePublished": post.data.date,
"image": imageUrl,
"url": pageUrl,
"author": {
"@type": "Organization",
"name": "Centro del Reino de Paz y Justicia"
}
})} />
<div class="container mx-auto py-16">
<Header />
</div>
<TitleSection title={post.data.title} />
<div class="container mx-auto">
{post.data.gallery && <CarouselSection images={post.data.gallery} />}
<div class="grid md:grid-cols-10">
<div id="article-content" class="md:col-span-7 content bg-white p-8 md:p-20 prose-p:mb-4 text-[#003421]">
<article id="article-body">
<time id="article-date" class="block text-center text-[#003421]/60 text-sm mb-8" datetime={dateISO}>
{localeDate}
</time>
<Content />
</article>
</div>
<div class="md:col-span-3 bg-tertiary md:sticky top-0 h-fit">
{ post.data.youtube && (
<YouTube id={post.data.youtube} />
)}
{post.data.gallery && (
post.data.gallery.map(galleryImage => (
<Image src={galleryImage.image} alt={galleryImage.text} />
))
)}
</div>
</div>
</div>
</MainLayout>
<FooterSection />

View File

@ -1,60 +0,0 @@
---
import MainLayout from "@/layouts/MainLayout.astro"
import NewsSection from "@/components/section/NewsSection.astro"
import Header from "@/components/Header.astro"
import NewsCard from "@/components/cards/NewsCard.astro";
import { getCollection, getEntry } from "astro:content";
import FooterSection from "@/components/section/FooterSection.astro";
import NewsList from "@/components/cards/NewsList.astro";
import { createTranslator, getLocalizedRoute, routeTranslations } from '@/i18n';
const tl = createTranslator(Astro.currentLocale);
export function getStaticPaths() {
const locales = Object.keys(routeTranslations.news);
return locales.map((locale) => ({
params: {
news_slug: getLocalizedRoute('news', locale)
},
}));
}
const newsItems = await getCollection("news", (post)=>{
const currentLocale = Astro.currentLocale;
return post.data.locale == currentLocale
});
---
<MainLayout >
<div class="top-16 relative mb container mx-auto">
<Header />
</div>
<div class="container mx-auto mt-4">
<div class="flex flex-col lg:w-1/2 items-center mx-auto py-8">
<h1 class="text-white text-2xl uppercase font-bold text-center mb-4 font-primary md:mt-20 mt-10">{tl("news.title")}</h1>
<h2 class="text-white text-3xl lg:text-5xl font-bold text-center font-secondary mb-4">{tl("news.text")}</h2>
<!-- <p class="text-white text-xl text-center">{tl("news.text3")}</p> -->
</div>
<div class="flex flex-col md:gap-8 gap-2 lg:max-w-4xl mx-auto bg-white p-8">
{
[...newsItems]
.sort((a, b) => {
const dateDiff =
new Date(b.data.date).getTime() - new Date(a.data.date).getTime()
if (dateDiff !== 0) return dateDiff
return (a.data.order ?? 0) - (b.data.order ?? 0)
})
.map((item) => (
<NewsList data={item} />
))
}
</div>
</div>
<FooterSection />
</MainLayout>

View File

@ -1,19 +0,0 @@
---
import MainLayout from "@/layouts/MainLayout.astro"
import Header from "@/components/Header.astro"
import FooterSection from "@/components/section/FooterSection.astro";
import { createTranslator, t } from '@/i18n';
const tl = createTranslator(Astro.currentLocale);
---
<MainLayout >
<div class="top-16 relative mb container mx-auto">
<Header />
<div class="container mx-auto mt-4">
page document.astro goes here
</div>
</div>
<FooterSection />
</MainLayout>

View File

@ -1,19 +0,0 @@
---
import MainLayout from "@/layouts/MainLayout.astro"
import Header from "@/components/Header.astro"
import FooterSection from "@/components/section/FooterSection.astro";
import { createTranslator, t } from '@/i18n';
const tl = createTranslator(Astro.currentLocale);
---
<MainLayout >
<div class="top-16 relative mb container mx-auto">
<Header />
<div class="container mx-auto mt-4">
page index of documents goes here
</div>
</div>
<FooterSection />
</MainLayout>

View File

@ -1,19 +0,0 @@
---
import MainLayout from "@/layouts/MainLayout.astro"
import Header from "@/components/Header.astro"
import FooterSection from "@/components/section/FooterSection.astro";
import { createTranslator, t } from '@/i18n';
const tl = createTranslator(Astro.currentLocale);
---
<MainLayout >
<div class="top-16 relative mb container mx-auto">
<Header />
<div class="container mx-auto mt-4">
page content goes here
</div>
</div>
<FooterSection />
</MainLayout>

View File

@ -1,19 +0,0 @@
---
import MainLayout from "@/layouts/MainLayout.astro"
import Header from "@/components/Header.astro"
import FooterSection from "@/components/section/FooterSection.astro";
import { createTranslator, t } from '@/i18n';
const tl = createTranslator(Astro.currentLocale);
---
<MainLayout >
<div class="top-16 relative mb container mx-auto">
<Header />
<div class="container mx-auto mt-4">
page nations [nation] goes here
</div>
</div>
<FooterSection />
</MainLayout>

View File

@ -1,19 +0,0 @@
---
import MainLayout from "@/layouts/MainLayout.astro"
import Header from "@/components/Header.astro"
import FooterSection from "@/components/section/FooterSection.astro";
import { createTranslator, t } from '@/i18n';
const tl = createTranslator(Astro.currentLocale);
---
<MainLayout >
<div class="top-16 relative mb container mx-auto">
<Header />
<div class="container mx-auto mt-4">
page index of nations goes here
</div>
</div>
<FooterSection />
</MainLayout>

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"version":{"fullVersion":"2.2.5","major":"2","minor":"2","patch":"5"},"meta":{"flags":["experimentalData"]},"collections":[{"name":"news","label":"News","path":"src/content/news","format":"md","fields":[{"type":"string","name":"locale","label":"Language","options":[{"label":"Español","value":"es"},{"label":"English","value":"en"},{"label":"Português","value":"pt"},{"label":"Kinyarwanda","value":"rw"},{"label":"Frances","value":"fr"}],"namespace":["news","locale"],"searchable":true,"uid":false},{"type":"string","name":"title","label":"Title","isTitle":true,"required":true,"namespace":["news","title"],"searchable":true,"uid":false},{"type":"datetime","name":"date","label":"Date","required":true,"namespace":["news","date"],"searchable":true,"uid":false},{"type":"string","name":"slug","label":"Slug","namespace":["news","slug"],"searchable":true,"uid":false},{"type":"string","name":"place","label":"Place","namespace":["news","place"],"searchable":true,"uid":false},{"type":"string","name":"thumbnail","label":"Thumbnail URL","namespace":["news","thumbnail"],"searchable":true,"uid":false},{"type":"string","name":"thumbnail_square","label":"Thumbnail Square URL","namespace":["news","thumbnail_square"],"searchable":true,"uid":false},{"type":"string","name":"youtube","label":"YouTube ID","namespace":["news","youtube"],"searchable":true,"uid":false},{"type":"string","name":"tags","label":"Tags (comma separated)","namespace":["news","tags"],"searchable":true,"uid":false},{"type":"boolean","name":"draft","label":"Draft","namespace":["news","draft"],"searchable":true,"uid":false},{"type":"rich-text","name":"body","label":"Content","isBody":true,"namespace":["news","body"],"searchable":true,"parser":{"type":"markdown"},"uid":false}],"namespace":["news"]},{"name":"documentaries","label":"Documentaries","path":"src/content/documentaries","format":"md","fields":[{"type":"string","name":"locale","label":"Language","options":[{"label":"Español","value":"es"},{"label":"English","value":"en"},{"label":"Português","value":"pt"},{"label":"Kinyarwanda","value":"rw"}],"namespace":["documentaries","locale"],"searchable":true,"uid":false},{"type":"string","name":"title","label":"Title","isTitle":true,"required":true,"namespace":["documentaries","title"],"searchable":true,"uid":false},{"type":"string","name":"video_yt","label":"YouTube ID","namespace":["documentaries","video_yt"],"searchable":true,"uid":false},{"type":"datetime","name":"date","label":"Date","required":true,"namespace":["documentaries","date"],"searchable":true,"uid":false}],"namespace":["documentaries"]}],"config":{"media":{"tina":{"publicFolder":"public","mediaRoot":"public/images"}}}} {"version":{"fullVersion":"2.2.5","major":"2","minor":"2","patch":"5"},"meta":{"flags":["experimentalData"]},"collections":[{"name":"news","label":"News","path":"src/content/news","format":"md","match":{"include":"**/*"},"ui":{"filename":{"readonly":false}},"fields":[{"type":"string","name":"locale","label":"Language","options":[{"label":"Español","value":"es"},{"label":"English","value":"en"},{"label":"Português","value":"pt"},{"label":"Kinyarwanda","value":"rw"},{"label":"Frances","value":"fr"}],"namespace":["news","locale"],"searchable":true,"uid":false},{"type":"string","name":"title","label":"Title","isTitle":true,"required":true,"namespace":["news","title"],"searchable":true,"uid":false},{"type":"datetime","name":"date","label":"Date","required":true,"namespace":["news","date"],"searchable":true,"uid":false},{"type":"string","name":"slug","label":"Slug","namespace":["news","slug"],"searchable":true,"uid":false},{"type":"string","name":"place","label":"Place","namespace":["news","place"],"searchable":true,"uid":false},{"type":"string","name":"country","label":"Country","namespace":["news","country"],"searchable":true,"uid":false},{"type":"string","name":"city","label":"City","namespace":["news","city"],"searchable":true,"uid":false},{"type":"image","name":"thumbnail","label":"Thumbnail URL","namespace":["news","thumbnail"],"searchable":false,"uid":false},{"type":"image","name":"thumbnail_square","label":"Thumbnail Square URL","namespace":["news","thumbnail_square"],"searchable":false,"uid":false},{"type":"string","name":"tags","label":"Tags","list":true,"namespace":["news","tags"],"searchable":true,"uid":false},{"type":"object","name":"gallery","label":"Gallery","list":true,"fields":[{"type":"image","name":"image","label":"Image","namespace":["news","gallery","image"],"searchable":false,"uid":false}],"namespace":["news","gallery"],"searchable":true,"uid":false},{"type":"string","name":"youtube","label":"YouTube ID","namespace":["news","youtube"],"searchable":true,"uid":false},{"type":"boolean","name":"draft","label":"Draft","namespace":["news","draft"],"searchable":true,"uid":false},{"type":"rich-text","name":"body","label":"Content","isBody":true,"namespace":["news","body"],"searchable":true,"parser":{"type":"markdown"},"uid":false}],"namespace":["news"]},{"name":"documentaries","label":"Documentaries","path":"src/content/documentaries","format":"md","fields":[{"type":"string","name":"locale","label":"Language","options":[{"label":"Español","value":"es"},{"label":"English","value":"en"},{"label":"Português","value":"pt"},{"label":"Kinyarwanda","value":"rw"}],"namespace":["documentaries","locale"],"searchable":true,"uid":false},{"type":"string","name":"title","label":"Title","isTitle":true,"required":true,"namespace":["documentaries","title"],"searchable":true,"uid":false},{"type":"string","name":"video_yt","label":"YouTube ID","namespace":["documentaries","video_yt"],"searchable":true,"uid":false},{"type":"datetime","name":"date","label":"Date","required":true,"namespace":["documentaries","date"],"searchable":true,"uid":false}],"namespace":["documentaries"]}],"config":{"media":{"tina":{"publicFolder":"public","mediaRoot":"public/images"}}}}

View File

@ -22,6 +22,17 @@ var config_default = defineConfig({
label: "News", label: "News",
path: "src/content/news", path: "src/content/news",
format: "md", format: "md",
match: {
include: "**/*"
},
ui: {
filename: {
readonly: false,
slugify: (values) => {
return values?.slug?.toLowerCase() || values?.title?.toLowerCase().replace(/ /g, "-");
}
}
},
fields: [ fields: [
{ {
type: "string", type: "string",
@ -60,23 +71,47 @@ var config_default = defineConfig({
}, },
{ {
type: "string", type: "string",
name: "country",
label: "Country"
},
{
type: "string",
name: "city",
label: "City"
},
{
type: "image",
name: "thumbnail", name: "thumbnail",
label: "Thumbnail URL" label: "Thumbnail URL"
}, },
{ {
type: "string", type: "image",
name: "thumbnail_square", name: "thumbnail_square",
label: "Thumbnail Square URL" label: "Thumbnail Square URL"
}, },
{ {
type: "string", type: "string",
name: "youtube", name: "tags",
label: "YouTube ID" label: "Tags",
list: true
},
{
type: "object",
name: "gallery",
label: "Gallery",
list: true,
fields: [
{
type: "image",
name: "image",
label: "Image"
}
]
}, },
{ {
type: "string", type: "string",
name: "tags", name: "youtube",
label: "Tags (comma separated)" label: "YouTube ID"
}, },
{ {
type: "boolean", type: "boolean",

View File

@ -5,10 +5,16 @@ fragment NewsParts on News {
date date
slug slug
place place
country
city
thumbnail thumbnail
thumbnail_square thumbnail_square
youtube
tags tags
gallery {
__typename
image
}
youtube
draft draft
body body
} }

View File

@ -90,16 +90,23 @@ type Collection {
union DocumentNode = News | Documentaries | Folder union DocumentNode = News | Documentaries | Folder
type NewsGallery {
image: String
}
type News implements Node & Document { type News implements Node & Document {
locale: String locale: String
title: String! title: String!
date: String! date: String!
slug: String slug: String
place: String place: String
country: String
city: String
thumbnail: String thumbnail: String
thumbnail_square: String thumbnail_square: String
tags: [String]
gallery: [NewsGallery]
youtube: String youtube: String
tags: String
draft: Boolean draft: Boolean
body: JSON body: JSON
id: ID! id: ID!
@ -122,6 +129,17 @@ input DatetimeFilter {
in: [String] in: [String]
} }
input ImageFilter {
startsWith: String
eq: String
exists: Boolean
in: [String]
}
input NewsGalleryFilter {
image: ImageFilter
}
input BooleanFilter { input BooleanFilter {
eq: Boolean eq: Boolean
exists: Boolean exists: Boolean
@ -139,10 +157,13 @@ input NewsFilter {
date: DatetimeFilter date: DatetimeFilter
slug: StringFilter slug: StringFilter
place: StringFilter place: StringFilter
thumbnail: StringFilter country: StringFilter
thumbnail_square: StringFilter city: StringFilter
youtube: StringFilter thumbnail: ImageFilter
thumbnail_square: ImageFilter
tags: StringFilter tags: StringFilter
gallery: NewsGalleryFilter
youtube: StringFilter
draft: BooleanFilter draft: BooleanFilter
body: RichTextFilter body: RichTextFilter
} }
@ -209,16 +230,23 @@ input DocumentMutation {
documentaries: DocumentariesMutation documentaries: DocumentariesMutation
} }
input NewsGalleryMutation {
image: String
}
input NewsMutation { input NewsMutation {
locale: String locale: String
title: String title: String
date: String date: String
slug: String slug: String
place: String place: String
country: String
city: String
thumbnail: String thumbnail: String
thumbnail_square: String thumbnail_square: String
tags: [String]
gallery: [NewsGalleryMutation]
youtube: String youtube: String
tags: String
draft: Boolean draft: Boolean
body: JSON body: JSON
} }

View File

@ -183,6 +183,11 @@ export type CollectionDocumentsArgs = {
export type DocumentNode = News | Documentaries | Folder; export type DocumentNode = News | Documentaries | Folder;
export type NewsGallery = {
__typename?: 'NewsGallery';
image?: Maybe<Scalars['String']['output']>;
};
export type News = Node & Document & { export type News = Node & Document & {
__typename?: 'News'; __typename?: 'News';
locale?: Maybe<Scalars['String']['output']>; locale?: Maybe<Scalars['String']['output']>;
@ -190,10 +195,13 @@ export type News = Node & Document & {
date: Scalars['String']['output']; date: Scalars['String']['output'];
slug?: Maybe<Scalars['String']['output']>; slug?: Maybe<Scalars['String']['output']>;
place?: Maybe<Scalars['String']['output']>; place?: Maybe<Scalars['String']['output']>;
country?: Maybe<Scalars['String']['output']>;
city?: Maybe<Scalars['String']['output']>;
thumbnail?: Maybe<Scalars['String']['output']>; thumbnail?: Maybe<Scalars['String']['output']>;
thumbnail_square?: Maybe<Scalars['String']['output']>; thumbnail_square?: Maybe<Scalars['String']['output']>;
tags?: Maybe<Array<Maybe<Scalars['String']['output']>>>;
gallery?: Maybe<Array<Maybe<NewsGallery>>>;
youtube?: Maybe<Scalars['String']['output']>; youtube?: Maybe<Scalars['String']['output']>;
tags?: Maybe<Scalars['String']['output']>;
draft?: Maybe<Scalars['Boolean']['output']>; draft?: Maybe<Scalars['Boolean']['output']>;
body?: Maybe<Scalars['JSON']['output']>; body?: Maybe<Scalars['JSON']['output']>;
id: Scalars['ID']['output']; id: Scalars['ID']['output'];
@ -216,6 +224,17 @@ export type DatetimeFilter = {
in?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>; in?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
}; };
export type ImageFilter = {
startsWith?: InputMaybe<Scalars['String']['input']>;
eq?: InputMaybe<Scalars['String']['input']>;
exists?: InputMaybe<Scalars['Boolean']['input']>;
in?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
};
export type NewsGalleryFilter = {
image?: InputMaybe<ImageFilter>;
};
export type BooleanFilter = { export type BooleanFilter = {
eq?: InputMaybe<Scalars['Boolean']['input']>; eq?: InputMaybe<Scalars['Boolean']['input']>;
exists?: InputMaybe<Scalars['Boolean']['input']>; exists?: InputMaybe<Scalars['Boolean']['input']>;
@ -233,10 +252,13 @@ export type NewsFilter = {
date?: InputMaybe<DatetimeFilter>; date?: InputMaybe<DatetimeFilter>;
slug?: InputMaybe<StringFilter>; slug?: InputMaybe<StringFilter>;
place?: InputMaybe<StringFilter>; place?: InputMaybe<StringFilter>;
thumbnail?: InputMaybe<StringFilter>; country?: InputMaybe<StringFilter>;
thumbnail_square?: InputMaybe<StringFilter>; city?: InputMaybe<StringFilter>;
youtube?: InputMaybe<StringFilter>; thumbnail?: InputMaybe<ImageFilter>;
thumbnail_square?: InputMaybe<ImageFilter>;
tags?: InputMaybe<StringFilter>; tags?: InputMaybe<StringFilter>;
gallery?: InputMaybe<NewsGalleryFilter>;
youtube?: InputMaybe<StringFilter>;
draft?: InputMaybe<BooleanFilter>; draft?: InputMaybe<BooleanFilter>;
body?: InputMaybe<RichTextFilter>; body?: InputMaybe<RichTextFilter>;
}; };
@ -366,16 +388,23 @@ export type DocumentMutation = {
documentaries?: InputMaybe<DocumentariesMutation>; documentaries?: InputMaybe<DocumentariesMutation>;
}; };
export type NewsGalleryMutation = {
image?: InputMaybe<Scalars['String']['input']>;
};
export type NewsMutation = { export type NewsMutation = {
locale?: InputMaybe<Scalars['String']['input']>; locale?: InputMaybe<Scalars['String']['input']>;
title?: InputMaybe<Scalars['String']['input']>; title?: InputMaybe<Scalars['String']['input']>;
date?: InputMaybe<Scalars['String']['input']>; date?: InputMaybe<Scalars['String']['input']>;
slug?: InputMaybe<Scalars['String']['input']>; slug?: InputMaybe<Scalars['String']['input']>;
place?: InputMaybe<Scalars['String']['input']>; place?: InputMaybe<Scalars['String']['input']>;
country?: InputMaybe<Scalars['String']['input']>;
city?: InputMaybe<Scalars['String']['input']>;
thumbnail?: InputMaybe<Scalars['String']['input']>; thumbnail?: InputMaybe<Scalars['String']['input']>;
thumbnail_square?: InputMaybe<Scalars['String']['input']>; thumbnail_square?: InputMaybe<Scalars['String']['input']>;
tags?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
gallery?: InputMaybe<Array<InputMaybe<NewsGalleryMutation>>>;
youtube?: InputMaybe<Scalars['String']['input']>; youtube?: InputMaybe<Scalars['String']['input']>;
tags?: InputMaybe<Scalars['String']['input']>;
draft?: InputMaybe<Scalars['Boolean']['input']>; draft?: InputMaybe<Scalars['Boolean']['input']>;
body?: InputMaybe<Scalars['JSON']['input']>; body?: InputMaybe<Scalars['JSON']['input']>;
}; };
@ -387,7 +416,7 @@ export type DocumentariesMutation = {
date?: InputMaybe<Scalars['String']['input']>; date?: InputMaybe<Scalars['String']['input']>;
}; };
export type NewsPartsFragment = { __typename: 'News', locale?: string | null, title: string, date: string, slug?: string | null, place?: string | null, thumbnail?: string | null, thumbnail_square?: string | null, youtube?: string | null, tags?: string | null, draft?: boolean | null, body?: any | null }; export type NewsPartsFragment = { __typename: 'News', locale?: string | null, title: string, date: string, slug?: string | null, place?: string | null, country?: string | null, city?: string | null, thumbnail?: string | null, thumbnail_square?: string | null, tags?: Array<string | null> | null, youtube?: string | null, draft?: boolean | null, body?: any | null, gallery?: Array<{ __typename: 'NewsGallery', image?: string | null } | null> | null };
export type DocumentariesPartsFragment = { __typename: 'Documentaries', locale?: string | null, title: string, video_yt?: string | null, date: string }; export type DocumentariesPartsFragment = { __typename: 'Documentaries', locale?: string | null, title: string, video_yt?: string | null, date: string };
@ -396,7 +425,7 @@ export type NewsQueryVariables = Exact<{
}>; }>;
export type NewsQuery = { __typename?: 'Query', news: { __typename: 'News', id: string, locale?: string | null, title: string, date: string, slug?: string | null, place?: string | null, thumbnail?: string | null, thumbnail_square?: string | null, youtube?: string | null, tags?: string | null, draft?: boolean | null, body?: any | null, _sys: { __typename?: 'SystemInfo', filename: string, basename: string, hasReferences?: boolean | null, breadcrumbs: Array<string>, path: string, relativePath: string, extension: string } } }; export type NewsQuery = { __typename?: 'Query', news: { __typename: 'News', id: string, locale?: string | null, title: string, date: string, slug?: string | null, place?: string | null, country?: string | null, city?: string | null, thumbnail?: string | null, thumbnail_square?: string | null, tags?: Array<string | null> | null, youtube?: string | null, draft?: boolean | null, body?: any | null, _sys: { __typename?: 'SystemInfo', filename: string, basename: string, hasReferences?: boolean | null, breadcrumbs: Array<string>, path: string, relativePath: string, extension: string }, gallery?: Array<{ __typename: 'NewsGallery', image?: string | null } | null> | null } };
export type NewsConnectionQueryVariables = Exact<{ export type NewsConnectionQueryVariables = Exact<{
before?: InputMaybe<Scalars['String']['input']>; before?: InputMaybe<Scalars['String']['input']>;
@ -408,7 +437,7 @@ export type NewsConnectionQueryVariables = Exact<{
}>; }>;
export type NewsConnectionQuery = { __typename?: 'Query', newsConnection: { __typename?: 'NewsConnection', totalCount: number, pageInfo: { __typename?: 'PageInfo', hasPreviousPage: boolean, hasNextPage: boolean, startCursor: string, endCursor: string }, edges?: Array<{ __typename?: 'NewsConnectionEdges', cursor: string, node?: { __typename: 'News', id: string, locale?: string | null, title: string, date: string, slug?: string | null, place?: string | null, thumbnail?: string | null, thumbnail_square?: string | null, youtube?: string | null, tags?: string | null, draft?: boolean | null, body?: any | null, _sys: { __typename?: 'SystemInfo', filename: string, basename: string, hasReferences?: boolean | null, breadcrumbs: Array<string>, path: string, relativePath: string, extension: string } } | null } | null> | null } }; export type NewsConnectionQuery = { __typename?: 'Query', newsConnection: { __typename?: 'NewsConnection', totalCount: number, pageInfo: { __typename?: 'PageInfo', hasPreviousPage: boolean, hasNextPage: boolean, startCursor: string, endCursor: string }, edges?: Array<{ __typename?: 'NewsConnectionEdges', cursor: string, node?: { __typename: 'News', id: string, locale?: string | null, title: string, date: string, slug?: string | null, place?: string | null, country?: string | null, city?: string | null, thumbnail?: string | null, thumbnail_square?: string | null, tags?: Array<string | null> | null, youtube?: string | null, draft?: boolean | null, body?: any | null, _sys: { __typename?: 'SystemInfo', filename: string, basename: string, hasReferences?: boolean | null, breadcrumbs: Array<string>, path: string, relativePath: string, extension: string }, gallery?: Array<{ __typename: 'NewsGallery', image?: string | null } | null> | null } | null } | null> | null } };
export type DocumentariesQueryVariables = Exact<{ export type DocumentariesQueryVariables = Exact<{
relativePath: Scalars['String']['input']; relativePath: Scalars['String']['input'];
@ -437,10 +466,16 @@ export const NewsPartsFragmentDoc = gql`
date date
slug slug
place place
country
city
thumbnail thumbnail
thumbnail_square thumbnail_square
youtube
tags tags
gallery {
__typename
image
}
youtube
draft draft
body body
} }

View File

@ -23,6 +23,17 @@ export default defineConfig({
label: "News", label: "News",
path: "src/content/news", path: "src/content/news",
format: "md", format: "md",
match: {
include: "**/*",
},
ui: {
filename: {
readonly: false,
slugify: (values) => {
return values?.slug?.toLowerCase() || values?.title?.toLowerCase().replace(/ /g, '-');
},
},
},
fields: [ fields: [
{ {
type: "string", type: "string",
@ -61,23 +72,47 @@ export default defineConfig({
}, },
{ {
type: "string", type: "string",
name: "country",
label: "Country",
},
{
type: "string",
name: "city",
label: "City",
},
{
type: "image",
name: "thumbnail", name: "thumbnail",
label: "Thumbnail URL", label: "Thumbnail URL",
}, },
{ {
type: "string", type: "image",
name: "thumbnail_square", name: "thumbnail_square",
label: "Thumbnail Square URL", label: "Thumbnail Square URL",
}, },
{ {
type: "string", type: "string",
name: "youtube", name: "tags",
label: "YouTube ID", label: "Tags",
list: true,
},
{
type: "object",
name: "gallery",
label: "Gallery",
list: true,
fields: [
{
type: "image",
name: "image",
label: "Image",
},
],
}, },
{ {
type: "string", type: "string",
name: "tags", name: "youtube",
label: "Tags (comma separated)", label: "YouTube ID",
}, },
{ {
type: "boolean", type: "boolean",

File diff suppressed because one or more lines are too long