Add SEO configuration for all the pages

astro
Kamran Ahmed 2 years ago
parent 64edd70ec4
commit d1445d6c7c
  1. 85
      src/layouts/BaseLayout.astro
  2. 5
      src/layouts/MarkdownLayout.astro
  3. 4
      src/lib/topic.ts
  4. 4
      src/pages/[...topicId].astro
  5. 7
      src/pages/[roadmapId]/index.astro
  6. 8
      src/pages/[roadmapId]/topics.astro
  7. 7
      src/pages/guides/[guideId].astro
  8. 2
      src/pages/guides/index.astro
  9. 2
      src/pages/index.astro
  10. 1
      src/pages/privacy.md
  11. 2
      src/pages/roadmaps.astro
  12. 5
      src/pages/signup.astro
  13. 1
      src/pages/terms.md
  14. 9
      src/pages/videos/[videoId].astro
  15. 5
      src/pages/videos/index.astro

@ -11,19 +11,14 @@ import { siteConfig } from '../lib/config';
export interface Props { export interface Props {
title: string; title: string;
description?: string; description?: string;
keywords?: string[];
sponsor?: SponsorType; sponsor?: SponsorType;
seo: {
title: string;
description: string;
keywords: string[];
};
} }
const { const {
title = siteConfig.title, title = siteConfig.title,
description = siteConfig.description, description = siteConfig.description,
keywords = siteConfig.keywords, keywords = siteConfig.keywords,
seo,
sponsor, sponsor,
} = Astro.props; } = Astro.props;
--- ---
@ -36,39 +31,63 @@ const {
<title>{title}</title> <title>{title}</title>
<meta name='description' content={description} /> <meta name='description' content={description} />
<meta name='author' content='Kamran Ahmed' /> <meta name='author' content='Kamran Ahmed' />
<meta name="keywords" content={ keywords.join(', ')} /> <meta name='keywords' content={keywords.join(', ')} />
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0, maximum-scale=3.0, minimum-scale=1.0"> <meta
<meta http-equiv="Content-Language" content="en" /> name='viewport'
content='width=device-width, user-scalable=yes, initial-scale=1.0, maximum-scale=3.0, minimum-scale=1.0'
/>
<meta http-equiv='Content-Language' content='en' />
<meta name="twitter:card" content="summary_large_image" /> <meta name='twitter:card' content='summary_large_image' />
<meta name="twitter:creator" content="@kamranahmedse" /> <meta name='twitter:creator' content='@kamranahmedse' />
<meta property="og:image:width" content="1200" /> <meta property='og:image:width' content='1200' />
<meta property="og:image:height" content="630" /> <meta property='og:image:height' content='630' />
<meta property="og:image" content="https://roadmap.sh/og-img.png" /> <meta property='og:image' content='https://roadmap.sh/og-img.png' />
<meta property="og:image:alt" content="roadmap.sh" /> <meta property='og:image:alt' content='roadmap.sh' />
<meta property="og:site_name" content="roadmap.sh" /> <meta property='og:site_name' content='roadmap.sh' />
<meta property="og:title" content={title } /> <meta property='og:title' content={title} />
<meta property="og:description" content={description} /> <meta property='og:description' content={description} />
<meta property="og:type" content="website" /> <meta property='og:type' content='website' />
<meta property="og:url" content="https://roadmap.sh" /> <meta property='og:url' content='https://roadmap.sh' />
<meta name="mobile-web-app-capable" content="yes" /> <meta name='mobile-web-app-capable' content='yes' />
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name='apple-mobile-web-app-capable' content='yes' />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" /> <meta
<meta name="apple-mobile-web-app-title" content="roadmap.sh" /> name='apple-mobile-web-app-status-bar-style'
<meta name="application-name" content="roadmap.sh" /> content='black-translucent'
/>
<meta name='apple-mobile-web-app-title' content='roadmap.sh' />
<meta name='application-name' content='roadmap.sh' />
<link rel="apple-touch-icon" sizes="180x180" href="/manifest/apple-touch-icon.png" /> <link
<meta name="msapplication-TileColor" content="#101010" /> rel='apple-touch-icon'
<meta name="theme-color" content="#848a9a" /> sizes='180x180'
href='/manifest/apple-touch-icon.png'
/>
<meta name='msapplication-TileColor' content='#101010' />
<meta name='theme-color' content='#848a9a' />
<link rel="manifest" href="/manifest/manifest.json" /> <link rel='manifest' href='/manifest/manifest.json' />
<link rel="icon" type="image/png" sizes="32x32" href="/manifest/icon32.png" /> <link
<link rel="icon" type="image/png" sizes="16x16" href="/manifest/icon16.png" /> rel='icon'
<link rel="shortcut icon" href="/manifest/favicon.ico" type="image/x-icon" /> type='image/png'
sizes='32x32'
href='/manifest/icon32.png'
/>
<link
rel='icon'
type='image/png'
sizes='16x16'
href='/manifest/icon16.png'
/>
<link
rel='shortcut icon'
href='/manifest/favicon.ico'
type='image/x-icon'
/>
<link rel="icon" href="/manifest/favicon.ico" type="image/x-icon" /> <link rel='icon' href='/manifest/favicon.ico' type='image/x-icon' />
<slot name='after-header' /> <slot name='after-header' />
</head> </head>

@ -1,8 +1,11 @@
--- ---
import BaseLayout from './BaseLayout.astro'; import BaseLayout from './BaseLayout.astro';
const { frontmatter = {} } = Astro.props;
const { title, description } = frontmatter;
--- ---
<BaseLayout title='Some'> <BaseLayout title={title} description={description}>
<div class='container prose py-12'> <div class='container prose py-12'>
<slot /> <slot />
</div> </div>

@ -66,7 +66,7 @@ export type BreadcrumbItem = {
export interface TopicFileType { export interface TopicFileType {
url: string; url: string;
text: string; heading: string;
file: MarkdownFileType; file: MarkdownFileType;
roadmap: RoadmapFrontmatter; roadmap: RoadmapFrontmatter;
roadmapId: string; roadmapId: string;
@ -102,7 +102,7 @@ export async function getTopicFiles(): Promise<Record<string, TopicFileType>> {
mapping[topicUrl] = { mapping[topicUrl] = {
url: topicUrl, url: topicUrl,
text: firstHeading?.text, heading: firstHeading?.text,
file: fileContent, file: fileContent,
roadmap: currentRoadmap.frontmatter, roadmap: currentRoadmap.frontmatter,
roadmapId: roadmapId, roadmapId: roadmapId,

@ -15,10 +15,10 @@ export async function getStaticPaths() {
} }
const { topicId } = Astro.params; const { topicId } = Astro.params;
const { file, breadcrumbs, roadmapId, roadmap } = Astro.props as TopicFileType; const { file, breadcrumbs, roadmapId, roadmap, heading } = Astro.props as TopicFileType;
--- ---
<BaseLayout title="What is this"> <BaseLayout title={`${heading} - roadmap.sh`} description={`Free resources to learn ${heading} in ${roadmap.featuredTitle}. Everything you need to know about ${heading} and how it realtes to ${roadmap.featuredTitle}.`}>
<RoadmapBanner roadmapId={roadmapId} roadmap={roadmap} /> <RoadmapBanner roadmapId={roadmapId} roadmap={roadmap} />
<div class="bg-gray-50"> <div class="bg-gray-50">
<Breadcrumbs breadcrumbs={breadcrumbs} roadmapId={roadmapId} /> <Breadcrumbs breadcrumbs={breadcrumbs} roadmapId={roadmapId} />

@ -22,7 +22,12 @@ const roadmapFile = await import(`../../roadmaps/${roadmapId}/${roadmapId}.md`);
const roadmapData = roadmapFile.frontmatter as RoadmapFrontmatter; const roadmapData = roadmapFile.frontmatter as RoadmapFrontmatter;
--- ---
<BaseLayout title='' sponsor={roadmapData.sponsor}> <BaseLayout
title={roadmapData?.seo?.title}
description={roadmapData.seo.description}
keywords={roadmapData.seo.keywords}
sponsor={roadmapData.sponsor}
>
<RoadmapHeader <RoadmapHeader
description={roadmapData.description} description={roadmapData.description}
title={roadmapData.title} title={roadmapData.title}

@ -22,10 +22,10 @@ const roadmapFile = await import(`../../roadmaps/${roadmapId}/${roadmapId}.md`);
const roadmapData = roadmapFile.frontmatter as RoadmapFrontmatter; const roadmapData = roadmapFile.frontmatter as RoadmapFrontmatter;
--- ---
<BaseLayout title="Topics"> <BaseLayout title={`${roadmapData.title} Topics`} description={roadmapData.seo.description} keywords={roadmapData.seo.keywords}>
<RoadmapHeader <RoadmapHeader
description={roadmapData.description} description={roadmapData.description}
title={roadmapData.title} title={`${roadmapData.featuredTitle} Topics`}
roadmapPermalink={`/${roadmapId}`} roadmapPermalink={`/${roadmapId}`}
hasSearch={true} hasSearch={true}
hasTopics={false} hasTopics={false}
@ -45,7 +45,7 @@ const roadmapData = roadmapFile.frontmatter as RoadmapFrontmatter;
return ( return (
<a <a
data-topic={topic.text.toLowerCase()} data-topic={topic.heading.toLowerCase()}
class:list={[ class:list={[
'cursor-pointer text-sm sm:text-md border-gray-200 border py-1.5 px-2 sm:py-2 sm:px-2.5 rounded-md block mb-0.5 sm:mb-1', 'cursor-pointer text-sm sm:text-md border-gray-200 border py-1.5 px-2 sm:py-2 sm:px-2.5 rounded-md block mb-0.5 sm:mb-1',
{ {
@ -56,7 +56,7 @@ const roadmapData = roadmapFile.frontmatter as RoadmapFrontmatter;
]} ]}
href={topic.url} href={topic.url}
> >
{topic.text} {topic.heading}
</a> </a>
); );
}) })

@ -19,13 +19,16 @@ export async function getStaticPaths() {
const { guideId } = Astro.params; const { guideId } = Astro.params;
const { guide } = Astro.props; const { guide } = Astro.props;
const { frontmatter: guideData } = guide;
--- ---
<BaseLayout title='Simple Guide'> <BaseLayout title={guideData.seo.title} description={guideData.seo.description}>
<GuideHeader guide={guide} /> <GuideHeader guide={guide} />
<div class='bg-gray-50 py-5 sm:py-10'> <div class='bg-gray-50 py-5 sm:py-10'>
<div class='container 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'> <div
class='container 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'
>
<guide.Content /> <guide.Content />
</div> </div>
</div> </div>

@ -7,7 +7,7 @@ import { getAllGuides } from '../../lib/guide';
const guides = await getAllGuides(); const guides = await getAllGuides();
--- ---
<BaseLayout title='Guides'> <BaseLayout title='Guides - roadmap.sh' description={'Detailed guides on Software Engineering Topics'}>
<SimplePageHeader <SimplePageHeader
title='Guides' title='Guides'
description='Succinct graphical explanations to engineering topics.' description='Succinct graphical explanations to engineering topics.'

@ -13,7 +13,7 @@ const guides = await getAllGuides();
const videos = await getAllVideos(); const videos = await getAllVideos();
--- ---
<BaseLayout title='Developer Roadmaps'> <BaseLayout title='Developer Roadmaps' description={"Community driven roadmaps, articles and guides for developers to grow in their career."}>
<div class='bg-gradient-to-b from-slate-900 to-black'> <div class='bg-gradient-to-b from-slate-900 to-black'>
<div class='border-b border-b-slate-900'> <div class='border-b border-b-slate-900'>
<div <div

@ -1,5 +1,6 @@
--- ---
layout: ../layouts/MarkdownLayout.astro layout: ../layouts/MarkdownLayout.astro
title: Privacy Policy - roadmap.sh
--- ---
# Privacy Policy # Privacy Policy

@ -8,7 +8,7 @@ const roleRoadmaps = await getRoadmapsByTag('role-roadmap');
const skillRoadmaps = await getRoadmapsByTag('skill-roadmap'); const skillRoadmaps = await getRoadmapsByTag('skill-roadmap');
--- ---
<BaseLayout title="Roadmap"> <BaseLayout title="Developer Roadmaps" description={"Step by step guides and paths to learn different tools or technologies"}>
<SimplePageHeader <SimplePageHeader
title="Developer Roadmaps" title="Developer Roadmaps"
description="Step by step guides and paths to learn different tools or technologies" description="Step by step guides and paths to learn different tools or technologies"

@ -3,7 +3,10 @@ import Captcha from '../components/Captcha/Captcha.astro';
import BaseLayout from '../layouts/BaseLayout.astro'; import BaseLayout from '../layouts/BaseLayout.astro';
--- ---
<BaseLayout title='Signup'> <BaseLayout
title='Signup - roadmap.sh'
description='Register yourself to receive occasional emails about new roadmaps, updates, guides and videos'
>
<div class='container'> <div class='container'>
<div <div
class='py-12 sm:py-0 sm:min-h-[550px] sm:max-w-[400px] mx-auto flex items-start sm:items-center flex-col justify-start sm:justify-center' class='py-12 sm:py-0 sm:min-h-[550px] sm:max-w-[400px] mx-auto flex items-start sm:items-center flex-col justify-start sm:justify-center'

@ -1,5 +1,6 @@
--- ---
layout: ../layouts/MarkdownLayout.astro layout: ../layouts/MarkdownLayout.astro
title: Terms and Conditions - roadmap.sh
--- ---
# Terms of Service # Terms of Service

@ -21,11 +21,16 @@ const { videoId } = Astro.params;
const { video } = Astro.props; const { video } = Astro.props;
--- ---
<BaseLayout title='Simple Video'> <BaseLayout
title={video.frontmatter.title}
description={video.frontmatter.description}
>
<VideoHeader video={video} /> <VideoHeader video={video} />
<div class='bg-gray-50 py-5 sm:py-10'> <div class='bg-gray-50 py-5 sm:py-10'>
<div class='container 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'> <div
class='container 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'
>
<video.Content /> <video.Content />
</div> </div>
</div> </div>

@ -7,7 +7,10 @@ import { getAllVideos } from '../../lib/video';
const videos = await getAllVideos(); const videos = await getAllVideos();
--- ---
<BaseLayout title='Videos'> <BaseLayout
title='Illustrated Videos - roadmap.sh'
description={'Graphical video demonstrations on software engineering topics.'}
>
<SimplePageHeader <SimplePageHeader
title='Videos' title='Videos'
description='Graphical video demonstrations on software engineering topics.' description='Graphical video demonstrations on software engineering topics.'

Loading…
Cancel
Save