--- import BestPracticeHeader from '../../components/BestPracticeHeader.astro'; import CaptchaScripts from '../../components/Captcha/CaptchaScripts.astro'; import FrameRenderer from '../../components/FrameRenderer/FrameRenderer.astro'; import MarkdownFile from '../../components/MarkdownFile.astro'; import ShareIcons from '../../components/ShareIcons/ShareIcons.astro'; import UpcomingForm from '../../components/UpcomingForm.astro'; import BaseLayout from '../../layouts/BaseLayout.astro'; import { BestPracticeFrontmatter, getBestPracticeIds } from '../../lib/best-pratice'; import { generateArticleSchema } from '../../lib/jsonld-schema'; export async function getStaticPaths() { const bestPracticeIds = await getBestPracticeIds(); return bestPracticeIds.map((bestPracticeId) => ({ params: { bestPracticeId }, })); } interface Params extends Record { bestPracticeId: string; } const { bestPracticeId } = Astro.params as Params; const bestPracticeFile = await import(`../../best-practices/${bestPracticeId}/${bestPracticeId}.md`); const bestPracticeData = bestPracticeFile.frontmatter as BestPracticeFrontmatter; let jsonLdSchema = []; if (bestPracticeData.schema) { const bestPracticeSchema = bestPracticeData.schema; jsonLdSchema.push( generateArticleSchema({ url: `https://roadmap.sh/best-practices/${bestPracticeId}`, headline: bestPracticeSchema.headline, description: bestPracticeSchema.description, datePublished: bestPracticeSchema.datePublished, dateModified: bestPracticeSchema.dateModified, imageUrl: bestPracticeSchema.imageUrl, }) ); } ---
{ !bestPracticeData.isUpcoming && bestPracticeData.jsonUrl && (
) } { !bestPracticeData.isUpcoming && !bestPracticeData.jsonUrl && ( ) }
{bestPracticeData.isUpcoming && }