parent
16eef91b30
commit
7fee35237a
7 changed files with 107 additions and 33 deletions
@ -0,0 +1,7 @@ |
||||
<div class='bg-gray-50 py-2'> |
||||
<div |
||||
class='container prose-blockquote:font-normal prose prose-code:bg-transparent prose-h2:text-3xl prose-h2:mt-4 prose-h2:mb-2 prose-h3:mt-2 prose-img:mt-1' |
||||
> |
||||
<slot /> |
||||
</div> |
||||
</div> |
@ -1,22 +0,0 @@ |
||||
--- |
||||
import DownloadPopup from './DownloadPopup.astro'; |
||||
import SubscribePopup from './SubscribePopup.astro'; |
||||
|
||||
export interface Props { |
||||
roadmapId: string; |
||||
description: string; |
||||
} |
||||
|
||||
const { roadmapId, description } = Astro.props; |
||||
--- |
||||
|
||||
<div class='bg-gray-50 py-2'> |
||||
<div |
||||
class='container prose prose-headings:mt-4 prose-headings:mb-2 prose-p:mb-0.5 relative prose-code:text-white' |
||||
> |
||||
<DownloadPopup /> |
||||
<SubscribePopup /> |
||||
|
||||
<slot /> |
||||
</div> |
||||
</div> |
@ -0,0 +1,86 @@ |
||||
--- |
||||
import CaptchaScripts from '../../components/Captcha/CaptchaScripts.astro'; |
||||
import FAQs from '../../components/FAQs/FAQs.astro'; |
||||
import InteractiveRoadmap from '../../components/InteractiveRoadmap/InteractiveRoadmap.astro'; |
||||
import MarkdownFile from '../../components/MarkdownFile.astro'; |
||||
import RoadmapHeader from '../../components/RoadmapHeader.astro'; |
||||
import UpcomingRoadmap from '../../components/UpcomingRoadmap.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<string, string | undefined> { |
||||
bestPracticeId: string; |
||||
} |
||||
|
||||
const { bestPracticeId } = Astro.params as Params; |
||||
const bestPracticeFile = await import(`../../best-practices/${bestPracticeId}/${bestPracticeId}.md`); |
||||
const { faqs: roadmapFAQs = [] } = await import(`../../roadmaps/${bestPracticeId}/faqs.astro`); |
||||
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, |
||||
}) |
||||
); |
||||
} |
||||
--- |
||||
|
||||
<BaseLayout |
||||
permalink={`/best-practices/${bestPracticeId}`} |
||||
title={bestPracticeData?.seo?.title} |
||||
description={bestPracticeData.seo.description} |
||||
keywords={bestPracticeData.seo.keywords} |
||||
sponsor={bestPracticeData.sponsor} |
||||
noIndex={bestPracticeData.isUpcoming} |
||||
jsonLd={jsonLdSchema} |
||||
> |
||||
<RoadmapHeader |
||||
title={bestPracticeData.title} |
||||
description={bestPracticeData.description} |
||||
roadmapId={bestPracticeId} |
||||
isUpcoming={bestPracticeData.isUpcoming} |
||||
/> |
||||
|
||||
{ |
||||
!bestPracticeData.isUpcoming && bestPracticeData.jsonUrl && ( |
||||
<InteractiveRoadmap |
||||
roadmapId={bestPracticeId} |
||||
description={bestPracticeData.description} |
||||
jsonUrl={bestPracticeData.jsonUrl} |
||||
dimensions={bestPracticeData.dimensions} |
||||
/> |
||||
) |
||||
} |
||||
|
||||
{ |
||||
!bestPracticeData.isUpcoming && !bestPracticeData.jsonUrl && ( |
||||
<MarkdownFile> |
||||
<bestPracticeFile.Content /> |
||||
</MarkdownFile> |
||||
) |
||||
} |
||||
|
||||
{bestPracticeData.isUpcoming && <UpcomingRoadmap />} |
||||
|
||||
<FAQs faqs={roadmapFAQs} /> |
||||
|
||||
<CaptchaScripts slot='after-footer' /> |
||||
</BaseLayout> |
Loading…
Reference in new issue