diff --git a/src/data/authors/kamran.md b/src/data/authors/kamran.md index 8e5f7c9ee..5b80785c4 100644 --- a/src/data/authors/kamran.md +++ b/src/data/authors/kamran.md @@ -1,6 +1,9 @@ --- name: 'Kamran Ahmed' imageUrl: '/authors/kamran.jpeg' +employment: + title: 'Founder' + company: 'roadmap.sh' social: linkedin: 'https://www.linkedin.com/in/kamrify' twitter: 'https://twitter.com/kamrify' diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index ae3adfc96..03518e347 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -145,7 +145,10 @@ const gaPageIdentifier = Astro.url.pathname { jsonLd.length > 0 && ( - + ) } diff --git a/src/lib/author.ts b/src/lib/author.ts index 86afb2a43..ac6606fe4 100644 --- a/src/lib/author.ts +++ b/src/lib/author.ts @@ -3,6 +3,10 @@ import type { MarkdownFileType } from './file'; export interface AuthorFrontmatter { name: string; imageUrl: string; + employment?: { + title: string; + company: string; + }; social: { twitter: string; github: string; diff --git a/src/pages/authors/[authorId].astro b/src/pages/authors/[authorId].astro index c3d9c349e..022cb93ed 100644 --- a/src/pages/authors/[authorId].astro +++ b/src/pages/authors/[authorId].astro @@ -2,10 +2,10 @@ import BaseLayout from '../../layouts/BaseLayout.astro'; import AstroIcon from '../../components/AstroIcon.astro'; import { getGuidesByAuthor } from '../../lib/guide'; -import {getAllVideos, getVideosByAuthor} from '../../lib/video'; +import { getAllVideos, getVideosByAuthor } from '../../lib/video'; import GuideListItem from '../../components/GuideListItem.astro'; import { getAuthorById, getAuthorIds } from '../../lib/author'; -import VideoListItem from "../../components/VideoListItem.astro"; +import VideoListItem from '../../components/VideoListItem.astro'; interface Params extends Record {} @@ -19,11 +19,9 @@ export async function getStaticPaths() { const { authorId } = Astro.params; -console.log(authorId); - const author = await getAuthorById(authorId); +const authorFrontmatter = author.frontmatter; -console.log(author); const guides = await getGuidesByAuthor(authorId); const videos = await getVideosByAuthor(authorId); --- @@ -35,14 +33,37 @@ const videos = await getVideosByAuthor(authorId); ogImageUrl={`https://roadmap.sh/${author.frontmatter.imageUrl}`} description={`${author.frontmatter.name} has written ${guides.length} articles on roadmap.sh on a variety of topics.`} noIndex={false} + jsonLd={[ + { + '@context': 'https://schema.org/', + '@type': 'Person', + name: authorFrontmatter.name, + url: `https://roadmap.sh/authors/${authorId}`, + image: authorFrontmatter.imageUrl.startsWith('http') + ? authorFrontmatter.imageUrl + : `https://roadmap.sh${authorFrontmatter.imageUrl}`, + sameAs: authorFrontmatter.social + ? Object.values(authorFrontmatter.social) + : [], + ...(authorFrontmatter.employment && { + jobTitle: authorFrontmatter.employment?.title, + worksFor: { + '@type': 'Organization', + name: authorFrontmatter.employment.company, + }, + }), + }, + ]} > - + - - {author.frontmatter.name} + + + {authorFrontmatter.name} + @@ -50,9 +71,9 @@ const videos = await getVideosByAuthor(authorId); { - author.frontmatter.social?.github && ( + authorFrontmatter.social?.github && ( @@ -61,9 +82,9 @@ const videos = await getVideosByAuthor(authorId); ) } { - author.frontmatter.social.twitter && ( + authorFrontmatter.social.twitter && ( @@ -72,9 +93,9 @@ const videos = await getVideosByAuthor(authorId); ) } { - author.frontmatter.social.linkedin && ( + authorFrontmatter.social.linkedin && ( @@ -83,9 +104,9 @@ const videos = await getVideosByAuthor(authorId); ) } { - author.frontmatter.social.website && ( + authorFrontmatter.social.website && ( @@ -100,7 +121,7 @@ const videos = await getVideosByAuthor(authorId);