1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-06-19 08:15:28 -04:00

homebrew comments system

This commit is contained in:
2025-05-14 09:47:51 -04:00
parent cce48e558f
commit b196249f25
61 changed files with 3616 additions and 397 deletions
+4 -5
View File
@@ -1,7 +1,6 @@
import { NextResponse } from "next/server";
import { unstable_cache as cache } from "next/cache";
import { getViews as _getViews } from "@/lib/posts";
import { POSTS_DIR } from "@/lib/config/constants";
import { getViews as _getViews } from "@/lib/server/views";
const getViews = cache(_getViews, undefined, {
revalidate: 300, // 5 minutes
@@ -25,9 +24,9 @@ export const GET = async (): Promise<
const total = {
hits: Object.values(views).reduce((acc, curr) => acc + curr, 0),
};
const pages = Object.entries(views).map(([slug, hits]) => ({
slug: `${POSTS_DIR}/${slug}`,
hits,
const pages = Object.entries(views).map(([slug, views]) => ({
slug,
hits: views,
}));
pages.sort((a, b) => b.hits - a.hits);