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; initialLoadingMessage?: string;
permalink?: string; permalink?: string;
jsonLd?: Record<string, unknown>[]; jsonLd?: Record<string, unknown>[];
categoryLevel0?: string;
categoryLevel1?: string;
} }
const { const {
@ -34,6 +36,8 @@ const {
jsonLd = [], jsonLd = [],
redirectUrl = '', redirectUrl = '',
initialLoadingMessage = '', initialLoadingMessage = '',
categoryLevel0 = '',
categoryLevel1 = '',
} = Astro.props; } = Astro.props;
// Remove trailing slashes to consider the page as canonical // Remove trailing slashes to consider the page as canonical
@ -156,6 +160,10 @@ const gaPageIdentifier = Astro.url.pathname
client:load 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' /> <slot name='after-footer' />
<Analytics /> <Analytics />

@ -2,7 +2,7 @@
import Breadcrumbs from '../../components/Breadcrumbs.astro'; import Breadcrumbs from '../../components/Breadcrumbs.astro';
import RoadmapBanner from '../../components/RoadmapBanner.astro'; import RoadmapBanner from '../../components/RoadmapBanner.astro';
import BaseLayout from '../../layouts/BaseLayout.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() { export async function getStaticPaths() {
const topicPathMapping = await getRoadmapTopicFiles(); 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}.`} 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} noIndex={true}
permalink={`/${roadmapId}/${topicId}`} permalink={`/${roadmapId}/${topicId}`}
categoryLevel0={roadmap.briefTitle}
categoryLevel1={heading}
> >
<RoadmapBanner roadmapId={roadmapId} roadmap={roadmap} /> <RoadmapBanner roadmapId={roadmapId} roadmap={roadmap} />
<div class='bg-gray-50'> <div class='bg-gray-50'>

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

@ -1,6 +1,6 @@
--- ---
import BaseLayout from '../../../layouts/BaseLayout.astro'; 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() { export async function getStaticPaths() {
const topicPathMapping = await getAllBestPracticeTopicFiles(); 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}.`} 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} noIndex={true}
permalink={`/best-practices/${bestPracticeId}/${topicId}`} permalink={`/best-practices/${bestPracticeId}/${topicId}`}
categoryLevel0={bestPractice.briefTitle}
categoryLevel1={heading}
> >
<div class='bg-gray-50'> <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'> <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} keywords={bestPracticeData.seo.keywords}
noIndex={bestPracticeData.isUpcoming} noIndex={bestPracticeData.isUpcoming}
jsonLd={jsonLdSchema} jsonLd={jsonLdSchema}
categoryLevel0={"Best Practices"}
categoryLevel1={bestPracticeData.briefTitle}
> >
<!-- Preload the font being used in the renderer --> <!-- Preload the font being used in the renderer -->
<link <link

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

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

Loading…
Cancel
Save