feat: add extra metadata for page.
This commit is contained in:
parent
0aba200b9f
commit
9f31da348c
@ -108,7 +108,7 @@ const pagesCollection = defineCollection({
|
||||
comments: z.boolean().optional().default(true),
|
||||
cover: image(defaultCover),
|
||||
published: z.boolean().optional().default(true),
|
||||
summary: z.string().optional().default(''),
|
||||
summary: z.string().optional(),
|
||||
friend: z.boolean().optional().default(false),
|
||||
toc: toc(),
|
||||
}),
|
||||
|
@ -24,7 +24,7 @@ const title =
|
||||
? `${options.title} - ${options.description}`
|
||||
: `${Astro.props.title} - ${options.title}`;
|
||||
const description = Astro.props.description || options.description;
|
||||
const showFooter = Astro.props.footer || true;
|
||||
const showFooter = Astro.props.footer !== undefined ? Astro.props.footer : true;
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
|
@ -20,8 +20,8 @@ const { page } = Astro.props;
|
||||
const { Content, headings } = await page.render();
|
||||
---
|
||||
|
||||
<BaseLayout title={page.title} footer={false}>
|
||||
<PageMeta slot="og" title={page.title} ogImageUrl={`/og/${page.slug}.png`} />
|
||||
<BaseLayout title={page.title} description={page.summary} footer={false}>
|
||||
<PageMeta slot="og" title={page.title} description={page.summary} ogImageUrl={`/og/${page.slug}.png`} />
|
||||
|
||||
<div class="row gx-0">
|
||||
<div class="col-lg-8 col-xl-7">
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { defaultOpenGraph, drawOpenGraph } from '@/helpers/og';
|
||||
import { getPage, getPost, pages, posts } from '@/helpers/schema';
|
||||
import options from '@/options';
|
||||
import type { APIRoute } from 'astro';
|
||||
|
||||
const fallback = async () =>
|
||||
@ -29,7 +30,7 @@ export const GET: APIRoute = async ({ params }) => {
|
||||
}
|
||||
|
||||
title = page.title;
|
||||
summary = page.summary;
|
||||
summary = page.summary || options.description;
|
||||
cover = page.cover.src;
|
||||
} else {
|
||||
title = post.title;
|
||||
|
Loading…
Reference in New Issue
Block a user