diff --git a/src/components/MarkdownDisplay.astro b/src/components/MarkdownDisplay.astro index 19daa14..78cce72 100644 --- a/src/components/MarkdownDisplay.astro +++ b/src/components/MarkdownDisplay.astro @@ -3,7 +3,7 @@ import { getLangFromUrl, useTranslations } from "@i18n/utils"; import { formatDate } from "@js/utils"; import type { CollectionEntry } from "astro:content"; import Card from "./Card"; -import FichesMetasDisplay from "./FichesMetasDisplay.astro"; +import FichesMetasDisplay from "./fiches/FichesMetasDisplay.astro"; import FichesTableValidation from "./fiches/FichesTableValidation.astro"; const REF_NAME = process.env.PUBLIC_REF_NAME; diff --git a/src/components/MetaItem.astro b/src/components/MetaItem.astro index 99743d0..24f82b3 100644 --- a/src/components/MetaItem.astro +++ b/src/components/MetaItem.astro @@ -4,17 +4,37 @@ import { getLangFromUrl, useTranslations, } from "@i18n/utils"; +import { getEntry } from "astro:content"; const { frontmatter, meta, fontSize = "normal", displayTitle = false, + collectionType = undefined, + collectionTypeMeta = undefined, } = Astro.props; const values = frontmatter[meta]; const toDisplay = values; const lang = getLangFromUrl(Astro.url); const t = useTranslations(lang); + +const PUBLIC_BASE = + import.meta.env.PUBLIC_BASE || process.env.PUBLIC_BASE + ? (import.meta.env.PUBLIC_BASE || process.env.PUBLIC_BASE) + "/" + : ""; + +const getDatas = async ({ collectionType, item, meta, collectionTypeMeta }) => { + const id = item[meta] + .replace(`src/content/${collectionType}/`, "") + .replace(".mdx", ""); + const o: any = await getEntry(collectionType, id); + const [lang, ...slug] = o.slug.split("/"); + return { + label: o.data[collectionTypeMeta], + path: `/${PUBLIC_BASE}${lang}/${collectionType}/${slug}`, + }; +}; --- { @@ -32,7 +52,25 @@ const t = useTranslations(lang); {capitalizeFirstLetter(t(meta))} : )}