mirror of
https://github.com/saicaca/fuwari.git
synced 2026-03-08 10:03:27 +01:00
feat: add front-matter variable category
This commit is contained in:
@@ -9,6 +9,7 @@ interface Props {
|
||||
published: Date;
|
||||
tags: string[];
|
||||
categories: string[];
|
||||
category: string;
|
||||
}
|
||||
const {published, tags, categories} = Astro.props;
|
||||
const className = Astro.props.class;
|
||||
|
||||
@@ -8,11 +8,12 @@ interface Props {
|
||||
published: Date;
|
||||
tags: string[];
|
||||
categories: string[];
|
||||
category: string;
|
||||
image: string;
|
||||
description: string;
|
||||
words: number;
|
||||
}
|
||||
const { entry, title, url, published, tags, categories, image, description, words } = Astro.props;
|
||||
const { entry, title, url, published, tags, categories, category, image, description, words } = Astro.props;
|
||||
const className = Astro.props.class;
|
||||
// console.log(Astro.props);
|
||||
import ImageBox from "./misc/ImageBox.astro";
|
||||
@@ -28,6 +29,11 @@ const coverWidth = "28%";
|
||||
|
||||
const { remarkPluginFrontmatter } = await entry.render();
|
||||
|
||||
let cate = categories;
|
||||
if (category) {
|
||||
cate = [category];
|
||||
}
|
||||
|
||||
---
|
||||
<div class:list={["card-base flex flex-col-reverse md:flex-col w-full rounded-[var(--radius-large)] overflow-hidden relative", className]}>
|
||||
<div class:list={["pl-9 pr-9 md:pr-2 pt-6 md:pt-7 pb-6 relative", {"w-full md:w-[calc(100%_-_52px_-_12px)]": !hasCover, "w-full md:w-[calc(100%_-_var(--coverWidth)_-_12px)]": hasCover}]}>
|
||||
@@ -43,7 +49,7 @@ const { remarkPluginFrontmatter } = await entry.render();
|
||||
</a>
|
||||
|
||||
<!-- metadata -->
|
||||
<PostMetadata published={published} tags={tags} categories={categories} class:list={{"mb-4": description, "mb-6": !description}}></PostMetadata>
|
||||
<PostMetadata published={published} tags={tags} categories={cate} class:list={{"mb-4": description, "mb-6": !description}}></PostMetadata>
|
||||
|
||||
<div class="transition text-black/75 dark:text-white/75 mb-3.5">
|
||||
{ description }
|
||||
|
||||
Reference in New Issue
Block a user