Skip to content

Commit

Permalink
feat(about): refactor structured data to use a function for improved …
Browse files Browse the repository at this point in the history
…maintainability
  • Loading branch information
1chooo committed Dec 27, 2024
1 parent edb4219 commit 5e2b2f1
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions apps/web/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,26 +72,31 @@ const header =
? `About ${firstName} ${lastName} 👨🏻‍💻`
: `About ${preferredName} 👨🏻‍💻`;

const structuredData = {
"@context": "http://schema.org",
"id": "http://www.1chooo.com#person",
"@type": "Person",
"givenName": "Chun-Ho",
"familyName": "Lin",
"additionalName": "Hugo",
"gender": "male",
"birthPlace": "New Taipei, TW",
"nationality": "Taiwan",
"jobTitle": "Software Engineer",
"skills": "Software Engineering, Web Development, Open Source",
"alumniOf": "National Central University",
"image": "https://www.1chooo.com/images/profile.webp",
"url": "http://www.1chooo.com",
"sameAs": [
"https://www.linkedin.com/in/1chooo/",
"http://github.com/1chooo",
"https://medium.com/@1chooo",
],
const addJsonLd = () => {
return {
__html: `{
"@context": "http://schema.org",
"id": "http://www.1chooo.com#person",
"@type": "Person",
"givenName": "Chun-Ho",
"familyName": "Lin",
"additionalName": "Hugo",
"gender": "male",
"birthPlace": "New Taipei, TW",
"nationality": "Taiwan",
"jobTitle": "Software Engineer",
"skills": "Software Engineering, Web Development, Open Source",
"alumniOf": "National Central University",
"image": "https://www.1chooo.com/images/profile.webp",
"url": "http://www.1chooo.com",
"sameAs": [
"https://www.linkedin.com/in/1chooo/",
"http://github.com/1chooo",
"https://medium.com/@1chooo",
],
}
`,
}
}

async function About() {
Expand All @@ -110,7 +115,8 @@ async function About() {
<Script
id="application/ld+json"
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(structuredData) }}
dangerouslySetInnerHTML={addJsonLd()}
key="1chooo-website-jsonld"
/>
<PageHeader header={header} />
<AboutHeader id="introduction" text={`${subHeader} (${pronouns})`} />
Expand Down

0 comments on commit 5e2b2f1

Please sign in to comment.