mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-08-31 13:01:43 +02:00
Partial usage in the topics
This commit is contained in:
@@ -158,13 +158,7 @@ export function TopicDetail(props: TopicDetailProps) {
|
|||||||
}
|
}
|
||||||
let topicHtml = '';
|
let topicHtml = '';
|
||||||
if (!isCustomResource) {
|
if (!isCustomResource) {
|
||||||
// It's full HTML with page body, head etc.
|
topicHtml = response as string;
|
||||||
// We only need the inner HTML of the #main-content
|
|
||||||
const node = new DOMParser().parseFromString(
|
|
||||||
response as string,
|
|
||||||
'text/html',
|
|
||||||
);
|
|
||||||
topicHtml = node?.getElementById('main-content')?.outerHTML || '';
|
|
||||||
} else {
|
} else {
|
||||||
setLinks((response as RoadmapContentDocument)?.links || []);
|
setLinks((response as RoadmapContentDocument)?.links || []);
|
||||||
setTopicTitle((response as RoadmapContentDocument)?.title || '');
|
setTopicTitle((response as RoadmapContentDocument)?.title || '');
|
||||||
|
@@ -24,40 +24,11 @@ export async function getStaticPaths() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const partial = true;
|
||||||
|
|
||||||
const { topicId } = Astro.params;
|
const { topicId } = Astro.params;
|
||||||
const { file, roadmapId, roadmap, heading } =
|
const { file, roadmapId, roadmap, heading } =
|
||||||
Astro.props as RoadmapTopicFileType;
|
Astro.props as RoadmapTopicFileType;
|
||||||
|
|
||||||
const gitHubBaseUrl =
|
|
||||||
'https://github.com/kamranahmedse/developer-roadmap/blob/master/src/data';
|
|
||||||
const gitHubFullUrl = file.file.replace(/^.+\/src\/data/, `${gitHubBaseUrl}/`);
|
|
||||||
const gitHubRelativeUrl = file.file.replace(/^.+\/src\/data/, 'src/data');
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout
|
<file.Content />
|
||||||
title={`${heading} - roadmap.sh`}
|
|
||||||
description={`Free resources to learn ${heading} in ${roadmap.briefTitle}. Everything you need to know about ${heading} and how it relates to ${roadmap.briefTitle}.`}
|
|
||||||
noIndex={true}
|
|
||||||
permalink={`/${roadmapId}/${topicId}`}
|
|
||||||
>
|
|
||||||
<RoadmapBanner roadmapId={roadmapId} roadmap={roadmap} />
|
|
||||||
<div class='bg-gray-50'>
|
|
||||||
<div
|
|
||||||
class='container prose pb-16 prose-h1:mb-4 prose-h2:mb-3 prose-h2:mt-0 prose-p:mt-0'
|
|
||||||
>
|
|
||||||
<main id='main-content'>
|
|
||||||
<file.Content />
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<p class='rounded-md border border-yellow-500 bg-white p-2 text-sm'>
|
|
||||||
Found any mistakes? Help us improve by <a
|
|
||||||
id='gh-file-url'
|
|
||||||
rel='nofollow'
|
|
||||||
target='_blank'
|
|
||||||
data-relative-url={gitHubRelativeUrl}
|
|
||||||
href={gitHubFullUrl}>updating the file here.</a
|
|
||||||
>.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</BaseLayout>
|
|
Reference in New Issue
Block a user