diff --git a/src/components/InteractiveRoadmap/InteractiveRoadmap.astro b/src/components/InteractiveRoadmap/InteractiveRoadmap.astro index 2bb16fef8..af1d7cb01 100644 --- a/src/components/InteractiveRoadmap/InteractiveRoadmap.astro +++ b/src/components/InteractiveRoadmap/InteractiveRoadmap.astro @@ -1,8 +1,6 @@ --- -import DownloadPopup from '../DownloadPopup.astro'; import Loader from '../Loader.astro'; import ShareIcons from '../ShareIcons.astro'; -import SubscribePopup from '../SubscribePopup.astro'; import TopicOverlay from '../TopicOverlay.astro'; import './InteractiveRoadmap.css'; @@ -34,8 +32,6 @@ const { roadmapId, jsonUrl, dimensions = null, description } = Astro.props; description={description} pageUrl={`https://roadmap.sh/${roadmapId}`} /> - -
+
+ +
+
diff --git a/src/components/MarkdownRoadmap.astro b/src/components/MarkdownRoadmap.astro deleted file mode 100644 index c98c89404..000000000 --- a/src/components/MarkdownRoadmap.astro +++ /dev/null @@ -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; ---- - -
-
- - - - -
-
diff --git a/src/components/RoadmapHeader.astro b/src/components/RoadmapHeader.astro index f1bad6c0c..69afe1da6 100644 --- a/src/components/RoadmapHeader.astro +++ b/src/components/RoadmapHeader.astro @@ -1,7 +1,9 @@ --- +import DownloadPopup from './DownloadPopup.astro'; import Icon from './Icon.astro'; import ResourcesAlert from './ResourcesAlert.astro'; import RoadmapNote from './RoadmapNote.astro'; +import SubscribePopup from './SubscribePopup.astro'; import TopicSearch from './TopicSearch/TopicSearch.astro'; import YouTubeAlert from './YouTubeAlert.astro'; @@ -20,6 +22,9 @@ const { title, description, roadmapId, isUpcoming = false, hasSearch = false, no const isRoadmapReady = !isUpcoming; --- + + +
diff --git a/src/pages/[roadmapId]/index.astro b/src/pages/[roadmapId]/index.astro index 7e9552962..37835a3fd 100644 --- a/src/pages/[roadmapId]/index.astro +++ b/src/pages/[roadmapId]/index.astro @@ -2,6 +2,7 @@ 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 MarkdownRoadmap from '../../components/MarkdownRoadmap.astro'; import RoadmapHeader from '../../components/RoadmapHeader.astro'; import UpcomingRoadmap from '../../components/UpcomingRoadmap.astro'; @@ -78,9 +79,11 @@ if (roadmapFAQs.length) { { !roadmapData.isUpcoming && !roadmapData.jsonUrl && ( - - - +
+ + + +
) } diff --git a/src/pages/best-practices/[bestPracticeId].astro b/src/pages/best-practices/[bestPracticeId].astro new file mode 100644 index 000000000..03a7a5744 --- /dev/null +++ b/src/pages/best-practices/[bestPracticeId].astro @@ -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 { + 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, + }) + ); +} +--- + + + + + { + !bestPracticeData.isUpcoming && bestPracticeData.jsonUrl && ( + + ) + } + + { + !bestPracticeData.isUpcoming && !bestPracticeData.jsonUrl && ( + + + + ) + } + + {bestPracticeData.isUpcoming && } + + + + + diff --git a/src/pages/guides/[guideId].astro b/src/pages/guides/[guideId].astro index ce7a4480d..285770731 100644 --- a/src/pages/guides/[guideId].astro +++ b/src/pages/guides/[guideId].astro @@ -1,5 +1,6 @@ --- import GuideHeader from '../../components/GuideHeader.astro'; +import MarkdownFile from '../../components/MarkdownFile.astro'; import BaseLayout from '../../layouts/BaseLayout.astro'; import { getAllGuides, GuideFileType } from '../../lib/guide'; @@ -30,10 +31,8 @@ const { frontmatter: guideData } = guide;
-
+ -
+