Skip to content

Commit 485420e

Browse files
committed
Use Astro.url for base, add to changelog schema
1 parent b52e0f1 commit 485420e

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

src/components/overrides/Head.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ if (Astro.props.entry.data.external_link) {
202202
}
203203
204204
const ogImagePath = await getOgImage(Astro.props.entry);
205-
const ogImageUrl = new URL(ogImagePath, Astro.site!.origin).toString();
205+
const ogImageUrl = new URL(ogImagePath, Astro.url.origin).toString();
206206
207207
const ogImageTags = [
208208
{

src/schemas/base.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { z } from "astro:schema";
22
import { BadgeConfigSchema } from "./types/badge";
3+
import type { SchemaContext } from "astro:content";
34

45
const spotlightAuthorDetails = z
56
.object({
@@ -12,7 +13,7 @@ const spotlightAuthorDetails = z
1213
"These are used to automatically add the SpotlightAuthorDetails component to the page. Refer to https://developers.cloudflare.com/style-guide/components/spotlight-author-details/.",
1314
);
1415

15-
export const baseSchema = ({ image }) =>
16+
export const baseSchema = ({ image }: SchemaContext) =>
1617
z.object({
1718
cover: image().optional(),
1819
pcx_content_type: z

src/schemas/changelog.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
import { reference } from "astro:content";
1+
import { reference, type SchemaContext } from "astro:content";
22
import { z } from "astro:schema";
33

4-
export const changelogSchema = z.object({
5-
title: z.string(),
6-
description: z.string(),
7-
date: z.coerce.date(),
8-
products: z
9-
.array(reference("products"))
10-
.default([])
11-
.describe(
12-
"An array of products to associate this changelog entry with. You may omit the product named after the folder this entry is in.",
13-
),
14-
});
4+
export const changelogSchema = ({ image }: SchemaContext) =>
5+
z.object({
6+
title: z.string(),
7+
description: z.string(),
8+
date: z.coerce.date(),
9+
products: z
10+
.array(reference("products"))
11+
.default([])
12+
.describe(
13+
"An array of products to associate this changelog entry with. You may omit the product named after the folder this entry is in.",
14+
),
15+
cover: image().optional(),
16+
});

0 commit comments

Comments
 (0)