diff --git a/src/components/News.astro b/src/components/News.astro index 6fb7c26..971e52b 100644 --- a/src/components/News.astro +++ b/src/components/News.astro @@ -1,11 +1,18 @@ --- import {getCollection} from 'astro:content'; -import {asLocale, slugToPostLink, useTranslations} from '../i18n/utils'; +import {asLocale, slugToPostLink, useTranslations, useLocalePages} from '../i18n/utils'; import {Image} from 'astro:assets'; import {mdExcerpt, pictureWidths} from './utils'; +interface Props { + limit: number; +} + +const {limit} = Astro.props; + const pageLang = Astro.currentLocale; const t = useTranslations(pageLang); +const p = useLocalePages(pageLang); const pages = await getCollection('posts', (entry) => { const [lang, ...slug] = entry.slug.split('/'); @@ -25,7 +32,7 @@ const paths = pages } return {params: {lang: asLocale(lang), slug: slug.join('/')}, props: page}; }) - .slice(0, 3); // Limit to 3 posts + .slice(0, limit); // Limit posts based on prop const newsItems: Array<{ title: string; @@ -48,43 +55,32 @@ const newsItems: Array<{ }); --- - -
- -
-

{t('news.title')}

-

- {t('news.subtitle')} -

-
- - - -
- - { - newsItems.map((news) => ( - - {news.title} -
-

{news.title}

-

{news.abstract}

-
-
+ + + + + diff --git a/src/i18n/translations.ts b/src/i18n/translations.ts index 23ed1ef..9fb913e 100644 --- a/src/i18n/translations.ts +++ b/src/i18n/translations.ts @@ -63,8 +63,11 @@ export const translations = { 'references.title': 'Referenzen & Beispiele', 'references.intro': 'Hier finden Sie einige Beispiele für unsere Arbeit. Diese Projekte zeigen, wie wir Geodaten und Zeitreihenverarbeitung in verschiedenen Anwendungsfällen einsetzen.', + 'news.nav': 'Neuigkeiten', 'news.title': 'Neueste Beiträge', 'news.subtitle': 'Bleiben Sie auf dem Laufenden mit unseren neuesten Nachrichten und Updates.', + 'news.allPosts': 'Alle Beiträge', + 'news.viewAll': 'Alle Beiträge anzeigen', 'footer.info': 'Informationen', 'footer.documentation': 'Dokumentation', 'footer.privacyPolicy': 'Datenschutzerklärung', @@ -146,8 +149,11 @@ export const translations = { 'references.title': 'References & Examples', 'references.intro': 'Here you will find some examples of our work. These projects show how we use geodata and time series processing in various applications.', + 'news.nav': 'News', 'news.title': 'Latest Posts', 'news.subtitle': 'Stay up to date with our latest news and updates.', + 'news.allPosts': 'All Posts', + 'news.viewAll': 'View all posts', 'footer.info': 'Information', 'footer.documentation': 'Documentation', 'footer.privacyPolicy': 'Privacy Policy', @@ -185,6 +191,7 @@ export const pages = { privacyPolicy: '/datenschutzerklaerung/', references: '/beispiele-referenzen/', services: '/services/', + news: '/neuigkeiten/', 404: '/404/', }, en: { @@ -197,6 +204,7 @@ export const pages = { privacyPolicy: '/en/privacy-policy/', references: '/en/examples-references/', services: '/en/services/', + news: '/en/news/', 404: '/en/404/', }, } as const; diff --git a/src/pages/en/news.astro b/src/pages/en/news.astro new file mode 100644 index 0000000..4791203 --- /dev/null +++ b/src/pages/en/news.astro @@ -0,0 +1,5 @@ +--- +import Page from '../neuigkeiten.astro'; +--- + + diff --git a/src/pages/index.astro b/src/pages/index.astro index 0e15bc2..5e18653 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -121,7 +121,24 @@ const p = useLocalePages(Astro.currentLocale);

- +
+ +
+

{t('news.title')}

+

+ {t('news.subtitle')} +

+
+ + +

diff --git a/src/pages/neuigkeiten.astro b/src/pages/neuigkeiten.astro new file mode 100644 index 0000000..baa7596 --- /dev/null +++ b/src/pages/neuigkeiten.astro @@ -0,0 +1,13 @@ +--- +import {useTranslations} from '../i18n/utils'; +import Layout from '../layouts/Layout.astro'; +import News from '../components/News.astro'; + +const t = useTranslations(Astro.currentLocale); +--- + + +

+ +
+