Add OG thumbnail to Photo Category Index
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
2
astro/src/types/photos/category.d.ts
vendored
2
astro/src/types/photos/category.d.ts
vendored
@@ -1,4 +1,6 @@
|
||||
type PhotoCategoryIndex = {
|
||||
type: "PhotoCategoryIndex";
|
||||
exists: boolean;
|
||||
|
||||
category: PhotoAlbumCategory;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user