diff --git a/_data/githubStarred.js b/_data/githubStarred.js index ababab2..659d181 100644 --- a/_data/githubStarred.js +++ b/_data/githubStarred.js @@ -1,12 +1,32 @@ /** * GitHub Starred Repos Metadata - * Provides build timestamp only — the starred page fetches all data - * client-side via Alpine.js to avoid loading 5000+ objects into - * Eleventy's memory during build (causes OOM on constrained containers). + * Fetches the starred API response (cached 15min) to extract totalCount. + * Only totalCount is passed to Eleventy's data cascade — the full star + * list is discarded after parsing, keeping build memory low. + * The starred page fetches all data client-side via Alpine.js. */ -export default function () { - return { - buildDate: new Date().toISOString(), - }; +import EleventyFetch from "@11ty/eleventy-fetch"; + +const INDIEKIT_URL = process.env.SITE_URL || "https://example.com"; + +export default async function () { + try { + const url = `${INDIEKIT_URL}/githubapi/api/starred/all`; + const response = await EleventyFetch(url, { + duration: "15m", + type: "json", + }); + + return { + totalCount: response.totalCount || 0, + buildDate: new Date().toISOString(), + }; + } catch (error) { + console.log(`[githubStarred] Could not fetch starred count: ${error.message}`); + return { + totalCount: 0, + buildDate: new Date().toISOString(), + }; + } } diff --git a/starred.njk b/starred.njk index 6445691..a179b62 100644 --- a/starred.njk +++ b/starred.njk @@ -34,35 +34,6 @@ eleventyExcludeFromCollections: true

- {# Search box #} - - {# Loading state #} - {# All starred repos — client-side rendered #} + {# Main content — shown after loading #}