Add category levels to pages

pull/3941/head
Kamran Ahmed 2 years ago
parent b86fafd538
commit d955044a3b
  1. 8
      src/layouts/BaseLayout.astro
  2. 4
      src/pages/[roadmapId]/[...topicId].astro
  3. 4
      src/pages/[roadmapId]/index.astro
  4. 4
      src/pages/best-practices/[bestPracticeId]/[...topicId].astro
  5. 2
      src/pages/best-practices/[bestPracticeId]/index.astro
  6. 4
      src/pages/guides/[guideId].astro
  7. 4
      src/pages/videos/[videoId].astro

@ -21,6 +21,8 @@ export interface Props {
initialLoadingMessage?: string;
permalink?: string;
jsonLd?: Record<string, unknown>[];
categoryLevel0?: string;
categoryLevel1?: string;
}
const {
@ -34,6 +36,8 @@ const {
jsonLd = [],
redirectUrl = '',
initialLoadingMessage = '',
categoryLevel0 = '',
categoryLevel1 = '',
} = Astro.props;
// Remove trailing slashes to consider the page as canonical
@ -156,6 +160,10 @@ const gaPageIdentifier = Astro.url.pathname
client:load
/>
{ categoryLevel0 && <span id="category-level-0" class="hidden">{categoryLevel0}</span>}
{ categoryLevel1 && <span id="category-level-1" class="hidden">{categoryLevel1}</span>}
<slot name='after-footer' />
<Analytics />

@ -2,7 +2,7 @@
import Breadcrumbs from '../../components/Breadcrumbs.astro';
import RoadmapBanner from '../../components/RoadmapBanner.astro';
import BaseLayout from '../../layouts/BaseLayout.astro';
import { getRoadmapTopicFiles, RoadmapTopicFileType } from '../../lib/roadmap-topic';
import { getRoadmapTopicFiles,RoadmapTopicFileType } from '../../lib/roadmap-topic';
export async function getStaticPaths() {
const topicPathMapping = await getRoadmapTopicFiles();
@ -31,6 +31,8 @@ const { file, breadcrumbs, roadmapId, roadmap, heading } = Astro.props as Roadma
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}`}
categoryLevel0={roadmap.briefTitle}
categoryLevel1={heading}
>
<RoadmapBanner roadmapId={roadmapId} roadmap={roadmap} />
<div class='bg-gray-50'>

@ -61,11 +61,13 @@ const contentContributionLink = `https://github.com/kamranahmedse/developer-road
<BaseLayout
permalink={`/${roadmapId}`}
title={roadmapData?.seo?.title}
briefTitle={roadmapData?.briefTitle}
briefTitle={roadmapData.briefTitle}
description={roadmapData.seo.description}
keywords={roadmapData.seo.keywords}
noIndex={roadmapData.isUpcoming}
jsonLd={jsonLdSchema}
categoryLevel0={'Roadmaps'}
categoryLevel1={roadmapData.briefTitle}
>
<!-- Preload the font being used in the renderer -->
<link

@ -1,6 +1,6 @@
---
import BaseLayout from '../../../layouts/BaseLayout.astro';
import { BestPracticeTopicFileType, getAllBestPracticeTopicFiles } from '../../../lib/best-practice-topic';
import { BestPracticeTopicFileType,getAllBestPracticeTopicFiles } from '../../../lib/best-practice-topic';
export async function getStaticPaths() {
const topicPathMapping = await getAllBestPracticeTopicFiles();
@ -29,6 +29,8 @@ const { file, bestPracticeId, bestPractice, heading } = Astro.props as BestPract
description={`Free resources to learn ${heading} in ${bestPractice.briefTitle}. Everything you need to know about ${heading} and how it realtes to ${bestPractice.briefTitle}.`}
noIndex={true}
permalink={`/best-practices/${bestPracticeId}/${topicId}`}
categoryLevel0={bestPractice.briefTitle}
categoryLevel1={heading}
>
<div class='bg-gray-50'>
<div class='container py-16 prose prose-p:mt-0 prose-h1:mb-4 prose-h2:mb-3 prose-h2:mt-0'>

@ -58,6 +58,8 @@ const contentContributionLink = `https://github.com/kamranahmedse/developer-road
keywords={bestPracticeData.seo.keywords}
noIndex={bestPracticeData.isUpcoming}
jsonLd={jsonLdSchema}
categoryLevel0={"Best Practices"}
categoryLevel1={bestPracticeData.briefTitle}
>
<!-- Preload the font being used in the renderer -->
<link

@ -2,7 +2,7 @@
import GuideHeader from '../../components/GuideHeader.astro';
import MarkdownFile from '../../components/MarkdownFile.astro';
import BaseLayout from '../../layouts/BaseLayout.astro';
import { getAllGuides, GuideFileType } from '../../lib/guide';
import { getAllGuides,GuideFileType } from '../../lib/guide';
export interface Props {
guide: GuideFileType;
@ -27,6 +27,8 @@ const { frontmatter: guideData } = guide;
description={guideData.seo.description}
permalink={`/guides/${guideId}`}
canonicalUrl={guideData.canonicalUrl}
categoryLevel0={"Guides"}
categoryLevel1={guideData.title}
>
<GuideHeader guide={guide} />

@ -1,7 +1,7 @@
---
import VideoHeader from '../../components/VideoHeader.astro';
import BaseLayout from '../../layouts/BaseLayout.astro';
import { getAllVideos, VideoFileType } from '../../lib/video';
import { getAllVideos,VideoFileType } from '../../lib/video';
export interface Props {
video: VideoFileType;
@ -24,6 +24,8 @@ const { video } = Astro.props;
title={video.frontmatter.title}
description={video.frontmatter.description}
permalink={`/videos/${videoId}`}
categoryLevel0={"Videos"}
categoryLevel1={video.frontmatter.title}
>
<VideoHeader video={video} />

Loading…
Cancel
Save