feat(top-tags): surface top tags and genres across relevant views

This commit is contained in:
Cory Dransfeldt 2025-05-15 08:54:59 -07:00
parent e133fd959d
commit 4f15e88074
No known key found for this signature in database
10 changed files with 94 additions and 9 deletions

27
src/data/topTags.js Normal file
View file

@ -0,0 +1,27 @@
import EleventyFetch from "@11ty/eleventy-fetch";
const { POSTGREST_URL, POSTGREST_API_KEY } = process.env;
const fetchTopTags = async () => {
try {
return await EleventyFetch(`${POSTGREST_URL}/rpc/get_top_tag_groups`, {
duration: "1h",
type: "json",
fetchOptions: {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${POSTGREST_API_KEY}`,
},
},
});
} catch (error) {
console.error("Error fetching top tag entries:", error);
return [];
}
};
export default async function () {
console.log(await fetchTopTags())
return await fetchTopTags();
}