Added open graph on scan and gallery pages
This commit is contained in:
parent
e2aa9a30ce
commit
030f0a1f34
1
TODO.md
1
TODO.md
|
@ -8,7 +8,6 @@
|
||||||
- Automatically generate different sizes of images
|
- Automatically generate different sizes of images
|
||||||
- Handle relationship in RichText Content
|
- Handle relationship in RichText Content
|
||||||
- On most pages (collectibles + pages), there is a gap in the breakpoints where no thumbnail is displayed.
|
- On most pages (collectibles + pages), there is a gap in the breakpoints where no thumbnail is displayed.
|
||||||
- Add duration on audio/video preview cards
|
|
||||||
- Add proper localization for formatFilesize, formatInches, formatMillimeters, formatPounds, and formatGrams
|
- Add proper localization for formatFilesize, formatInches, formatMillimeters, formatPounds, and formatGrams
|
||||||
|
|
||||||
## Mid term
|
## Mid term
|
||||||
|
|
|
@ -3,6 +3,7 @@ import AppEmptyLayout from "components/AppLayout/AppEmptyLayout.astro";
|
||||||
import Lightbox from "components/Lightbox.astro";
|
import Lightbox from "components/Lightbox.astro";
|
||||||
import { getI18n } from "src/i18n/i18n";
|
import { getI18n } from "src/i18n/i18n";
|
||||||
import { payload } from "src/shared/payload/payload-sdk";
|
import { payload } from "src/shared/payload/payload-sdk";
|
||||||
|
import { formatInlineTitle, formatRichTextToString } from "src/utils/format";
|
||||||
import { fetchOr404 } from "src/utils/responses";
|
import { fetchOr404 } from "src/utils/responses";
|
||||||
|
|
||||||
const slug = Astro.params.slug!;
|
const slug = Astro.params.slug!;
|
||||||
|
@ -53,7 +54,13 @@ const tagsAndAttributes = [
|
||||||
|
|
||||||
{/* ------------------------------------------- HTML ------------------------------------------- */}
|
{/* ------------------------------------------- HTML ------------------------------------------- */}
|
||||||
|
|
||||||
<AppEmptyLayout parentPages={parentPages}>
|
<AppEmptyLayout
|
||||||
|
openGraph={{
|
||||||
|
thumbnail: image,
|
||||||
|
description: description ? formatRichTextToString(description) : undefined,
|
||||||
|
title: formatInlineTitle({ pretitle, title, subtitle }),
|
||||||
|
}}
|
||||||
|
parentPages={parentPages}>
|
||||||
<Lightbox
|
<Lightbox
|
||||||
image={image}
|
image={image}
|
||||||
pretitle={pretitle}
|
pretitle={pretitle}
|
||||||
|
|
|
@ -4,23 +4,30 @@ import AppLayoutTitle from "components/AppLayout/components/AppLayoutTitle.astro
|
||||||
import RichText from "components/RichText/RichText.astro";
|
import RichText from "components/RichText/RichText.astro";
|
||||||
import { getI18n } from "src/i18n/i18n";
|
import { getI18n } from "src/i18n/i18n";
|
||||||
import { payload } from "src/shared/payload/payload-sdk";
|
import { payload } from "src/shared/payload/payload-sdk";
|
||||||
|
import { formatInlineTitle, formatRichTextToString } from "src/utils/format";
|
||||||
import { fetchOr404 } from "src/utils/responses";
|
import { fetchOr404 } from "src/utils/responses";
|
||||||
|
|
||||||
const slug = Astro.params.slug!;
|
const slug = Astro.params.slug!;
|
||||||
const { getLocalizedMatch, getLocalizedUrl } = await getI18n(Astro.locals.currentLocale);
|
const { getLocalizedMatch, getLocalizedUrl, t } = await getI18n(Astro.locals.currentLocale);
|
||||||
|
|
||||||
const gallery = await fetchOr404(() => payload.getCollectibleGallery(slug));
|
const gallery = await fetchOr404(() => payload.getCollectibleGallery(slug));
|
||||||
if (gallery instanceof Response) {
|
if (gallery instanceof Response) {
|
||||||
return gallery;
|
return gallery;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { translations, parentPages, images } = gallery;
|
const { translations, parentPages, images, thumbnail } = gallery;
|
||||||
const translation = getLocalizedMatch(translations);
|
const translation = getLocalizedMatch(translations);
|
||||||
---
|
---
|
||||||
|
|
||||||
{/* ------------------------------------------- HTML ------------------------------------------- */}
|
{/* ------------------------------------------- HTML ------------------------------------------- */}
|
||||||
|
|
||||||
<AppEmptyLayout parentPages={parentPages}>
|
<AppEmptyLayout
|
||||||
|
openGraph={{
|
||||||
|
title: `${formatInlineTitle(translation)} (${t("collectibles.gallery")})`,
|
||||||
|
description: translation.description && formatRichTextToString(translation.description),
|
||||||
|
thumbnail,
|
||||||
|
}}
|
||||||
|
parentPages={parentPages}>
|
||||||
<AppLayoutTitle
|
<AppLayoutTitle
|
||||||
title={translation.title}
|
title={translation.title}
|
||||||
pretitle={translation.pretitle}
|
pretitle={translation.pretitle}
|
||||||
|
|
|
@ -3,23 +3,33 @@ import AppEmptyLayout from "components/AppLayout/AppEmptyLayout.astro";
|
||||||
import Lightbox from "components/Lightbox.astro";
|
import Lightbox from "components/Lightbox.astro";
|
||||||
import { getI18n } from "src/i18n/i18n";
|
import { getI18n } from "src/i18n/i18n";
|
||||||
import { payload } from "src/shared/payload/payload-sdk";
|
import { payload } from "src/shared/payload/payload-sdk";
|
||||||
|
import { formatInlineTitle, formatRichTextToString } from "src/utils/format";
|
||||||
import { fetchOr404 } from "src/utils/responses";
|
import { fetchOr404 } from "src/utils/responses";
|
||||||
|
|
||||||
const slug = Astro.params.slug!;
|
const slug = Astro.params.slug!;
|
||||||
const index = Astro.params.index!;
|
const index = Astro.params.index!;
|
||||||
const { formatScanIndexShort, getLocalizedUrl } = await getI18n(Astro.locals.currentLocale);
|
const { formatScanIndexShort, getLocalizedMatch, getLocalizedUrl } = await getI18n(
|
||||||
|
Astro.locals.currentLocale
|
||||||
|
);
|
||||||
|
|
||||||
const scanPage = await fetchOr404(() => payload.getCollectibleScanPage(slug, index));
|
const scanPage = await fetchOr404(() => payload.getCollectibleScanPage(slug, index));
|
||||||
if (scanPage instanceof Response) {
|
if (scanPage instanceof Response) {
|
||||||
return scanPage;
|
return scanPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { parentPages, previousIndex, nextIndex, image } = scanPage;
|
const { parentPages, previousIndex, nextIndex, image, translations } = scanPage;
|
||||||
|
const translation = getLocalizedMatch(translations);
|
||||||
---
|
---
|
||||||
|
|
||||||
{/* ------------------------------------------- HTML ------------------------------------------- */}
|
{/* ------------------------------------------- HTML ------------------------------------------- */}
|
||||||
|
|
||||||
<AppEmptyLayout parentPages={parentPages}>
|
<AppEmptyLayout
|
||||||
|
openGraph={{
|
||||||
|
title: `${formatInlineTitle(translation)} (${index})`,
|
||||||
|
description: translation.description && formatRichTextToString(translation.description),
|
||||||
|
thumbnail: image,
|
||||||
|
}}
|
||||||
|
parentPages={parentPages}>
|
||||||
<Lightbox
|
<Lightbox
|
||||||
image={image}
|
image={image}
|
||||||
title={formatScanIndexShort(index)}
|
title={formatScanIndexShort(index)}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { getI18n } from "src/i18n/i18n";
|
||||||
import { payload } from "src/shared/payload/payload-sdk";
|
import { payload } from "src/shared/payload/payload-sdk";
|
||||||
import { fetchOr404 } from "src/utils/responses";
|
import { fetchOr404 } from "src/utils/responses";
|
||||||
import ScanPreview from "./_components/ScanPreview.astro";
|
import ScanPreview from "./_components/ScanPreview.astro";
|
||||||
|
import { formatInlineTitle, formatRichTextToString } from "src/utils/format";
|
||||||
|
|
||||||
const slug = Astro.params.slug!;
|
const slug = Astro.params.slug!;
|
||||||
const { getLocalizedMatch, t } = await getI18n(Astro.locals.currentLocale);
|
const { getLocalizedMatch, t } = await getI18n(Astro.locals.currentLocale);
|
||||||
|
@ -16,7 +17,7 @@ if (scans instanceof Response) {
|
||||||
return scans;
|
return scans;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { translations, credits, cover, pages, dustjacket, obi, parentPages } = scans;
|
const { translations, credits, cover, pages, dustjacket, obi, parentPages, thumbnail } = scans;
|
||||||
|
|
||||||
const translation = getLocalizedMatch(translations);
|
const translation = getLocalizedMatch(translations);
|
||||||
|
|
||||||
|
@ -38,7 +39,13 @@ const hasOutsideObi = obi ? Object.keys(obi).some((value) => !value.includes("in
|
||||||
|
|
||||||
{/* ------------------------------------------- HTML ------------------------------------------- */}
|
{/* ------------------------------------------- HTML ------------------------------------------- */}
|
||||||
|
|
||||||
<AppEmptyLayout parentPages={parentPages}>
|
<AppEmptyLayout
|
||||||
|
openGraph={{
|
||||||
|
title: `${formatInlineTitle(translation)} (${t("collectibles.scans")})`,
|
||||||
|
description: translation.description && formatRichTextToString(translation.description),
|
||||||
|
thumbnail,
|
||||||
|
}}
|
||||||
|
parentPages={parentPages}>
|
||||||
<AppLayoutTitle
|
<AppLayoutTitle
|
||||||
title={translation.title}
|
title={translation.title}
|
||||||
pretitle={translation.pretitle}
|
pretitle={translation.pretitle}
|
||||||
|
|
|
@ -1637,6 +1637,7 @@ export type EndpointCollectibleGalleryImage = {
|
||||||
pretitle?: string;
|
pretitle?: string;
|
||||||
title: string;
|
title: string;
|
||||||
subtitle?: string;
|
subtitle?: string;
|
||||||
|
description?: RichTextContent;
|
||||||
}[];
|
}[];
|
||||||
image: EndpointImage;
|
image: EndpointImage;
|
||||||
previousIndex?: string;
|
previousIndex?: string;
|
||||||
|
@ -1652,6 +1653,7 @@ export type EndpointCollectibleScanPage = {
|
||||||
pretitle?: string;
|
pretitle?: string;
|
||||||
title: string;
|
title: string;
|
||||||
subtitle?: string;
|
subtitle?: string;
|
||||||
|
description?: RichTextContent;
|
||||||
}[];
|
}[];
|
||||||
image: EndpointScanImage;
|
image: EndpointScanImage;
|
||||||
previousIndex?: string;
|
previousIndex?: string;
|
||||||
|
|
Loading…
Reference in New Issue