diff --git a/public/news/900px-logo.png b/public/news/900px-logo.png new file mode 100644 index 0000000..4fecff1 Binary files /dev/null and b/public/news/900px-logo.png differ diff --git a/src/pages/events/index.astro b/src/pages/events/index.astro index 3615d06..7febed9 100644 --- a/src/pages/events/index.astro +++ b/src/pages/events/index.astro @@ -5,6 +5,12 @@ import SiteFooter from "../../components/SiteFooter.astro"; import { navigationItems } from "../../lib/navigation"; import { newsArticles, formatNewsDate } from "../../lib/news"; +const PER_PAGE = 4; +const totalPages = Math.ceil(newsArticles.length / PER_PAGE); +const currentPage = 1; +const pagedArticles = newsArticles.slice(0, PER_PAGE); +const pageHref = (page) => (page === 1 ? "/events" : `/events/page/${page}`); + const pageSeo = { title: "News", description: @@ -75,7 +81,7 @@ const pageSeo = {
{ - newsArticles.map((item) => ( + pagedArticles.map((item) => (
diff --git a/src/pages/events/page/[page].astro b/src/pages/events/page/[page].astro new file mode 100644 index 0000000..fb556bd --- /dev/null +++ b/src/pages/events/page/[page].astro @@ -0,0 +1,190 @@ +--- +import BaseLayout from "../../../layouts/BaseLayout.astro"; +import SiteHeader from "../../../components/SiteHeader.astro"; +import SiteFooter from "../../../components/SiteFooter.astro"; +import { navigationItems } from "../../../lib/navigation"; +import { newsArticles, formatNewsDate } from "../../../lib/news"; + +export function getStaticPaths() { + const PER_PAGE = 4; + const totalPages = Math.ceil(newsArticles.length / PER_PAGE); + const pages = Array.from( + { length: totalPages }, + (_, index) => index + 1, + ).filter((page) => page > 1); + + return pages.map((page) => ({ + params: { page: String(page) }, + })); +} + +const currentPage = Number(Astro.params.page ?? "1"); +const PER_PAGE = 4; +const totalPages = Math.ceil(newsArticles.length / PER_PAGE); +const start = (currentPage - 1) * PER_PAGE; +const pagedArticles = newsArticles.slice(start, start + PER_PAGE); +const pageHref = (page) => (page === 1 ? "/events" : `/events/page/${page}`); + +const pageSeo = { + title: `News - Page ${currentPage}`, + description: + "Stay updated with Highland Group RDA news, events, and stories. Discover how our riders, volunteers, and community are making a difference every day.", + keywords: + "Highland RDA news, RDA events, disability riding stories, RDA updates, equestrian therapy news, Highlands charity events", + canonicalPath: `/events/page/${currentPage}`, +}; +--- + + +
+
+
+
+
+ +
+
+

+ Latest News +

+
+

+ Updates from Highland Group RDA +

+

+ Stories, milestones, and updates from the yard, + our riders, volunteers, and supporters. +

+
+
+ + Donate via JustGiving + +
+
+ +
+
+ + { + totalPages > 1 ? ( + + ) : null + } +
+
+ +
+
+