Update some metadata for the photo category page

This commit is contained in:
itsfinniii
2026-04-03 22:33:41 +02:00
parent aa93600c79
commit 32c698c39a
7 changed files with 51 additions and 16 deletions

View File

@@ -239,7 +239,7 @@ export async function getCategoryAlbums(settings: GlobalSettings, route: string)
const client = await createDirectusConnection();
const result = await client.query(print(getCategoryAlbumQuery), {
date: formatDate(new Date(), "%Y-%M-%D"),
categoryUrl: `/${route}`
categoryUrl: route
});
let albums: PhotoAlbum[] = [];

View File

@@ -1,6 +1,7 @@
import { createDirectusConnection } from "@/lib/directus";
import { print } from "graphql";
import getCategories from '@/graphql/photos/getCategories.graphql';
import getCategory from '@/graphql/photos/getCategory.graphql';
export async function getAllCategories(settings: GlobalSettings): Promise<PhotoAlbumCategory[]> {
const client = await createDirectusConnection();
@@ -23,3 +24,26 @@ export async function getAllCategories(settings: GlobalSettings): Promise<PhotoA
return categories;
}
export async function getPhotoCategory(url: string): Promise<PhotoAlbumCategory> {
const client = await createDirectusConnection();
const result = await client.query(print(getCategory), {
url: url
});
const item = result["Photo_Categories"][0];
let categories: PhotoAlbumCategory = {
id: item["id"],
title: item["title"],
url: item["url"],
thumbnail: {
url: item["thumbnail"]["filename_disk"],
width: item["thumbnail"]["width"],
height: item["thumbnail"]["height"]
}
};
return categories;
}