fix: front-matter prop change

This commit is contained in:
saicaca
2023-10-21 10:52:01 +08:00
parent b9489a51b3
commit 9b68fd1b86
10 changed files with 18 additions and 31 deletions

View File

@@ -5,11 +5,11 @@ interface Props {
url: string;
published: Date;
tags: string[];
cover: string;
image: string;
description: string;
words: number;
}
const { title, url, published, tags, cover, description, words } = Astro.props;
const { title, url, published, tags, image, description, words } = Astro.props;
// console.log(Astro.props);
import ImageBox from "./misc/ImageBox.astro";
import ButtonTag from "./control/ButtonTag.astro";
@@ -19,7 +19,7 @@ import { Icon } from 'astro-icon/components';
// const cover = 'https://saicaca.github.io/vivia-preview/assets/79905307_p0.jpg';
// cover = null;
const hasCover = cover !== undefined && cover !== null && cover !== '';
const hasCover = image !== undefined && image !== null && image !== '';
---

View File

@@ -8,11 +8,11 @@ interface Props {
published: Date;
tags: string[];
categories: string[];
cover: string;
image: string;
description: string;
words: number;
}
const { entry, title, url, published, tags, categories, cover, description, words } = Astro.props;
const { entry, title, url, published, tags, categories, image, description, words } = Astro.props;
const className = Astro.props.class;
// console.log(Astro.props);
import ImageBox from "./misc/ImageBox.astro";
@@ -22,7 +22,7 @@ import Button from "./control/Button.astro";
import {i18n} from "../i18n/translation";
import I18nKey from "../i18n/i18nKey";
const hasCover = cover !== undefined && cover !== null && cover !== '';
const hasCover = image !== undefined && image !== null && image !== '';
const coverWidth = "28%";
@@ -67,7 +67,7 @@ const { remarkPluginFrontmatter } = await entry.render();
class="transition opacity-0 group-hover:opacity-100 text-white text-5xl">
</Icon>
</div>
<ImageBox src={cover} alt={entry.data.cover.alt || "Cover Image of the Post"}
<ImageBox src={image} alt="Cover Image of the Post"
class="w-full h-full">
</ImageBox>
</a>}