Skip to content

Commit

Permalink
add json schemaorg in SEO (academicpages#292)
Browse files Browse the repository at this point in the history
* add json schemaorg

* fix on url and name

---------

Co-authored-by: Carmine Di Gruttola <carmine.di.gruttola@pwc.com>
  • Loading branch information
cdigruttola and Carmine Di Gruttola authored May 26, 2023
1 parent 22664b3 commit 1a6a95d
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
60 changes: 59 additions & 1 deletion src/components/seoHeader/SeoHeader.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,73 @@
import React from "react";
import { Helmet } from "react-helmet";
import { seo } from "../../portfolio.js";
import {
greeting,
seo,
socialMediaLinks,
experience,
contactPageData,
certifications,
} from "../../portfolio.js";

function SeoHeader() {
let sameAs = [];
socialMediaLinks
.filter(
(media) =>
!(media.link.startsWith("tel") || media.link.startsWith("mailto"))
)
.forEach((media) => {
sameAs.push(media.link);
});

let mail = socialMediaLinks
.find((media) => media.link.startsWith("mailto"))
.link.substring("mailto:".length);
let job = experience.sections
?.find((section) => section.work)
?.experiences?.at(0);

let credentials = [];
certifications.certifications.forEach((certification) => {
credentials.push({
"@context": "https://schema.org",
"@type": "EducationalOccupationalCredential",
url: certification.certificate_link,
name: certification.title,
description: certification.subtitle,
});
});
const data = {
"@context": "https://schema.org/",
"@type": "Person",
name: greeting.title,
url: seo?.og?.url,
email: mail,
telephone: contactPageData.phoneSection?.subtitle,
sameAs: sameAs,
jobTitle: job.title,
worksFor: {
"@type": "Organization",
name: job.company,
},
address: {
"@type": "PostalAddress",
addressLocality: contactPageData.addressSection?.locality,
addressRegion: contactPageData.addressSection?.region,
addressCountry: contactPageData.addressSection?.country,
postalCode: contactPageData.addressSection?.postalCode,
streetAddress: contactPageData.addressSection?.streetAddress,
},
hasCredential: credentials,
};
return (
<Helmet>
<title>{seo.title}</title>
<meta name="description" content={seo.description} />
<meta property="og:title" content={seo?.og?.title} />
<meta property="og:type" content={seo?.og?.type} />
<meta property="og:url" content={seo?.og?.url} />
<script type="application/ld+json">{JSON.stringify(data)}</script>
</Helmet>
);
}
Expand Down
6 changes: 6 additions & 0 deletions src/portfolio.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ const experience = {
sections: [
{
title: "Work",
work: true,
experiences: [
{
title: "Associate AI Engineer",
Expand Down Expand Up @@ -749,6 +750,11 @@ const contactPageData = {
title: "Address",
subtitle:
"Ambavadi vas, Kanodar, T.A.-Palanpur, Dist.-Banaskantha, Gujarat - 385520",
locality: "Kanodar",
country: "IN",
region: "Gujarat",
postalCode: "385520",
streetAddress: "Ambavadi vas",
avatar_image_path: "address_image.svg",
location_map_link: "https://goo.gl/maps/MpMqtRZytFchMkZ76",
},
Expand Down

0 comments on commit 1a6a95d

Please sign in to comment.