diff --git a/_data/blogrollStatus.js b/_data/blogrollStatus.js index aee1601..d2999c1 100644 --- a/_data/blogrollStatus.js +++ b/_data/blogrollStatus.js @@ -4,7 +4,7 @@ * Used for conditional navigation — the blogroll page itself loads data client-side. */ -import EleventyFetch from "@11ty/eleventy-fetch"; +import { cachedFetch } from "../lib/data-fetch.js"; const INDIEKIT_URL = process.env.SITE_URL || "https://example.com"; @@ -12,7 +12,7 @@ export default async function () { try { const url = `${INDIEKIT_URL}/blogrollapi/api/status`; console.log(`[blogrollStatus] Checking API: ${url}`); - const data = await EleventyFetch(url, { + const data = await cachedFetch(url, { duration: "15m", type: "json", }); diff --git a/_data/conversationMentions.js b/_data/conversationMentions.js index 1652f37..4af7bc9 100644 --- a/_data/conversationMentions.js +++ b/_data/conversationMentions.js @@ -1,8 +1,8 @@ -import EleventyFetch from "@11ty/eleventy-fetch"; +import { cachedFetch } from "../lib/data-fetch.js"; export default async function () { try { - const data = await EleventyFetch( + const data = await cachedFetch( "http://127.0.0.1:8080/conversations/api/mentions?per-page=10000", { duration: "15m", type: "json" } ); diff --git a/_data/githubRepos.js b/_data/githubRepos.js index 1b8fe5f..9b1bc34 100644 --- a/_data/githubRepos.js +++ b/_data/githubRepos.js @@ -3,7 +3,7 @@ * Fetches public repositories from GitHub API */ -import EleventyFetch from "@11ty/eleventy-fetch"; +import { cachedFetch } from "../lib/data-fetch.js"; export default async function () { const username = process.env.GITHUB_USERNAME || ""; @@ -12,7 +12,7 @@ export default async function () { // Fetch public repos, sorted by updated date const url = `https://api.github.com/users/${username}/repos?sort=updated&per_page=10&type=owner`; - const repos = await EleventyFetch(url, { + const repos = await cachedFetch(url, { duration: "1h", // Cache for 1 hour type: "json", fetchOptions: { diff --git a/_data/newsActivity.js b/_data/newsActivity.js index 47499b8..3c63883 100644 --- a/_data/newsActivity.js +++ b/_data/newsActivity.js @@ -3,7 +3,7 @@ * Fetches from Indiekit's endpoint-rss public API */ -import EleventyFetch from "@11ty/eleventy-fetch"; +import { cachedFetch } from "../lib/data-fetch.js"; const INDIEKIT_URL = process.env.SITE_URL || "https://example.com"; @@ -14,7 +14,7 @@ async function fetchFromIndiekit(endpoint) { try { const url = `${INDIEKIT_URL}/rssapi/api/${endpoint}`; console.log(`[newsActivity] Fetching from Indiekit: ${url}`); - const data = await EleventyFetch(url, { + const data = await cachedFetch(url, { duration: "15m", type: "json", }); diff --git a/_data/podrollStatus.js b/_data/podrollStatus.js index cf117e5..9ac88cb 100644 --- a/_data/podrollStatus.js +++ b/_data/podrollStatus.js @@ -4,7 +4,7 @@ * Used for conditional navigation — the podroll page itself loads data client-side. */ -import EleventyFetch from "@11ty/eleventy-fetch"; +import { cachedFetch } from "../lib/data-fetch.js"; const INDIEKIT_URL = process.env.SITE_URL || "https://example.com"; @@ -12,7 +12,7 @@ export default async function () { try { const url = `${INDIEKIT_URL}/podrollapi/api/status`; console.log(`[podrollStatus] Checking API: ${url}`); - const data = await EleventyFetch(url, { + const data = await cachedFetch(url, { duration: "15m", type: "json", }); diff --git a/_data/recentComments.js b/_data/recentComments.js index bdd1ede..0f9edda 100644 --- a/_data/recentComments.js +++ b/_data/recentComments.js @@ -3,7 +3,7 @@ * Fetches the 5 most recent comments at build time for the sidebar widget. */ -import EleventyFetch from "@11ty/eleventy-fetch"; +import { cachedFetch } from "../lib/data-fetch.js"; const INDIEKIT_URL = process.env.SITE_URL || "https://example.com"; @@ -11,7 +11,7 @@ export default async function () { try { const url = `${INDIEKIT_URL}/comments/api/comments?limit=5`; console.log(`[recentComments] Fetching: ${url}`); - const data = await EleventyFetch(url, { + const data = await cachedFetch(url, { duration: "15m", type: "json", }); diff --git a/_data/youtubeChannel.js b/_data/youtubeChannel.js index 7fbf461..81be351 100644 --- a/_data/youtubeChannel.js +++ b/_data/youtubeChannel.js @@ -4,7 +4,7 @@ * Supports single or multiple channels */ -import EleventyFetch from "@11ty/eleventy-fetch"; +import { cachedFetch } from "../lib/data-fetch.js"; const INDIEKIT_URL = process.env.SITE_URL || "https://example.com"; @@ -15,7 +15,7 @@ async function fetchFromIndiekit(endpoint) { try { const url = `${INDIEKIT_URL}/youtubeapi/api/${endpoint}`; console.log(`[youtubeChannel] Fetching from Indiekit: ${url}`); - const data = await EleventyFetch(url, { + const data = await cachedFetch(url, { duration: "5m", type: "json", }); diff --git a/_includes/components/comments.njk b/_includes/components/comments.njk index dacd261..445fe96 100644 --- a/_includes/components/comments.njk +++ b/_includes/components/comments.njk @@ -30,7 +30,7 @@ {# Sign-in form (shown when not authenticated) #} -
Sign in with your website to comment: