feat(top-tags): surface top tags and genres across relevant views
This commit is contained in:
parent
e133fd959d
commit
4f15e88074
10 changed files with 94 additions and 9 deletions
27
src/data/topTags.js
Normal file
27
src/data/topTags.js
Normal 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();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue