3 Commits

Author SHA1 Message Date
itsfinniii
aa93600c79 Add OG thumbnail to Photo Category Index 2026-04-03 22:16:17 +02:00
itsfinniii
0b45967d30 Require at least one photo category before actually rendering pages of the photos 2026-04-03 22:12:12 +02:00
itsfinniii
39c26e73c6 Fix vulnerable packages 2026-04-03 22:00:15 +02:00
5 changed files with 1028 additions and 533 deletions

1479
astro/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
import { getBlog } from "@/content/blogs/blogs";
import { getWebpage } from "@/content/pages/pages";
import { getAlbum } from "@/content/photos/albums";
import { getAllCategories } from "@/content/photos/categories";
import { getPhotoFromHash } from "@/content/photos/photos";
import { getProject } from "@/content/projects/projects";
@@ -91,10 +92,14 @@ export async function getPage(settings: GlobalSettings, route: string): Promise<
}
// Photo Category Index
else if (regexToRoute({ template: settings.photo.categoryIndex.indexRouteTemplate, allowPagination: false }).regex.test(route)) {
const allCategories = await getAllCategories(settings);
const lastCategory = allCategories[0];
return {
route: route,
pageType: "PhotoCategoryIndex",
page: {
category: lastCategory,
type: "PhotoCategoryIndex",
exists: true
}

View File

@@ -11,7 +11,9 @@ export async function getAllRoutesList(settings: GlobalSettings): Promise<string
const webpages = await getAllWebpages();
webpages.forEach((webpage) => {
routes.push(webpage.url);
if (webpage.exists) {
routes.push(webpage.url);
}
});
if (settings.blog.enabled) {
@@ -48,42 +50,45 @@ export async function getAllRoutesList(settings: GlobalSettings): Promise<string
}
if (settings.photo.enabled) {
const categories = await getAllCategories(settings);
const galleries = await getAllAlbums(settings);
routes.push(settings.photo.categoryIndex.indexRouteTemplate);
if (categories.length > 0) {
const galleries = await getAllAlbums(settings);
categories.forEach((category) => {
let albums = galleries.filter(g => g.category.id === category.id);
const pages = Math.ceil(albums.length / settings.photo.category.perPage);
const categoryRoute = getCategoryRoute(settings.photo, category);
routes.push(settings.photo.categoryIndex.indexRouteTemplate);
for (let i = 0; i < pages; i++) {
if (i !== 0) {
routes.push(`${categoryRoute}/${i + 1}`);
categories.forEach((category) => {
let albums = galleries.filter(g => g.category.id === category.id);
const pages = Math.ceil(albums.length / settings.photo.category.perPage);
const categoryRoute = getCategoryRoute(settings.photo, category);
for (let i = 0; i < pages; i++) {
if (i !== 0) {
routes.push(`${categoryRoute}/${i + 1}`);
}
else {
routes.push(`${categoryRoute}`);
}
}
else {
routes.push(`${categoryRoute}`);
}
}
});
galleries.forEach((gallery) => {
const pages = Math.ceil(gallery.photos.length / settings.photo.album.perPage);
const galleryRoute = getAlbumRoute(settings.photo, gallery);
for (let i = 0; i < pages; i++) {
if (i !== 0) {
routes.push(`${galleryRoute}/${i + 1}`);
}
else {
routes.push(`${galleryRoute}`);
}
}
gallery.photos.forEach((photo) => {
routes.push(getPhotoRoute(settings.photo, gallery, photo));
});
});
galleries.forEach((gallery) => {
const pages = Math.ceil(gallery.photos.length / settings.photo.album.perPage);
const galleryRoute = getAlbumRoute(settings.photo, gallery);
for (let i = 0; i < pages; i++) {
if (i !== 0) {
routes.push(`${galleryRoute}/${i + 1}`);
}
else {
routes.push(`${galleryRoute}`);
}
}
gallery.photos.forEach((photo) => {
routes.push(getPhotoRoute(settings.photo, gallery, photo));
});
});
}
}
return routes;

View File

@@ -147,13 +147,13 @@ if (page === null || page.page === null || !page.page.exists) {
{ page.pageType === "PhotoCategoryIndex" && (
<WebpageLayout settings={{
searchEngine: {
title: "Projects",
title: "Categories",
description: "",
allowCrawlers: true,
canonical: null,
priority: 65,
thumbnail: {
url: "",
url: page.page.category.thumbnail.url,
width: 1200,
height: 630
}
@@ -167,7 +167,7 @@ if (page === null || page.page === null || !page.page.exists) {
{ page.pageType === "PhotoCategory" && (
<WebpageLayout settings={{
searchEngine: {
title: "Projects",
title: "",
description: "",
allowCrawlers: true,
canonical: null,

View File

@@ -1,4 +1,6 @@
type PhotoCategoryIndex = {
type: "PhotoCategoryIndex";
exists: boolean;
category: PhotoAlbumCategory;
}