Add og metatags to public facing pages
All checks were successful
Publish Docker Image / Publish Docker Image (push) Successful in 11s

This commit is contained in:
Ahmed Al-Taiar
2024-10-22 16:48:48 -04:00
parent f8987b08da
commit 62ce137bcb
9 changed files with 96 additions and 52 deletions

View File

@ -3,10 +3,12 @@ import type {
ContactCardPortraitVariables, ContactCardPortraitVariables,
} from 'types/graphql' } from 'types/graphql'
import type { import { routes } from '@redwoodjs/router'
TypedDocumentNode, import {
CellFailureProps, type TypedDocumentNode,
CellSuccessProps, type CellFailureProps,
type CellSuccessProps,
Metadata,
} from '@redwoodjs/web' } from '@redwoodjs/web'
import CellEmpty from 'src/components/Cell/CellEmpty/CellEmpty' import CellEmpty from 'src/components/Cell/CellEmpty/CellEmpty'
@ -43,5 +45,20 @@ export const Success = ({
portrait, portrait,
socials, socials,
}: CellSuccessProps<ContactCardPortrait, ContactCardPortraitVariables>) => ( }: CellSuccessProps<ContactCardPortrait, ContactCardPortraitVariables>) => (
<>
<Metadata
title="Contact"
og={{
title: 'Contact',
type: 'website',
image: {
url: portrait.fileId,
type: 'image/webp',
alt: `${process.env.FIRST_NAME} ${process.env.LAST_NAME}`,
},
url: routes.contact(),
}}
/>
<ContactCard portraitUrl={portrait.fileId} socials={socials} /> <ContactCard portraitUrl={portrait.fileId} socials={socials} />
</>
) )

View File

@ -1,9 +1,11 @@
import type { FindProjectById, FindProjectByIdVariables } from 'types/graphql' import type { FindProjectById, FindProjectByIdVariables } from 'types/graphql'
import type { import { routes } from '@redwoodjs/router'
CellSuccessProps, import {
CellFailureProps, type CellSuccessProps,
TypedDocumentNode, type CellFailureProps,
type TypedDocumentNode,
Metadata,
} from '@redwoodjs/web' } from '@redwoodjs/web'
import CellEmpty from 'src/components/Cell/CellEmpty/CellEmpty' import CellEmpty from 'src/components/Cell/CellEmpty/CellEmpty'
@ -40,5 +42,23 @@ export const Failure = ({
export const Success = ({ export const Success = ({
project, project,
}: CellSuccessProps<FindProjectById, FindProjectByIdVariables>) => ( }: CellSuccessProps<FindProjectById, FindProjectByIdVariables>) => (
<>
<Metadata
title={project.title}
og={{
title: project.title,
type: 'website',
image:
project.images.length > 0
? {
url: project.images[0],
type: 'image/webp',
alt: 'Image 1',
}
: undefined,
url: routes.project({ id: project.id }),
}}
/>
<Project project={project} /> <Project project={project} />
</>
) )

View File

@ -1,9 +1,11 @@
import type { FindProjects, FindProjectsVariables } from 'types/graphql' import type { FindProjects, FindProjectsVariables } from 'types/graphql'
import type { import { routes } from '@redwoodjs/router'
CellSuccessProps, import {
CellFailureProps, type CellSuccessProps,
TypedDocumentNode, type CellFailureProps,
type TypedDocumentNode,
Metadata,
} from '@redwoodjs/web' } from '@redwoodjs/web'
import CellEmpty from 'src/components/Cell/CellEmpty/CellEmpty' import CellEmpty from 'src/components/Cell/CellEmpty/CellEmpty'
@ -40,5 +42,16 @@ export const Failure = ({ error }: CellFailureProps<FindProjectsVariables>) => (
export const Success = ({ export const Success = ({
projects, projects,
}: CellSuccessProps<FindProjects, FindProjectsVariables>) => ( }: CellSuccessProps<FindProjects, FindProjectsVariables>) => (
<>
<Metadata
title="Projects"
og={{
title: 'Projects',
type: 'website',
description: `${projects.length} projects`,
url: routes.projects(),
}}
/>
<ProjectsShowcase projects={projects} /> <ProjectsShowcase projects={projects} />
</>
) )

View File

@ -1,9 +1,11 @@
import type { FindResume, FindResumeVariables } from 'types/graphql' import type { FindResume, FindResumeVariables } from 'types/graphql'
import type { import { routes } from '@redwoodjs/router'
CellSuccessProps, import {
CellFailureProps, type CellSuccessProps,
TypedDocumentNode, type CellFailureProps,
type TypedDocumentNode,
Metadata,
} from '@redwoodjs/web' } from '@redwoodjs/web'
import CellEmpty from 'src/components/Cell/CellEmpty/CellEmpty' import CellEmpty from 'src/components/Cell/CellEmpty/CellEmpty'
@ -29,5 +31,15 @@ export const Failure = ({ error }: CellFailureProps<FindResumeVariables>) => (
export const Success = ({ export const Success = ({
resume, resume,
}: CellSuccessProps<FindResume, FindResumeVariables>) => ( }: CellSuccessProps<FindResume, FindResumeVariables>) => (
<>
<Metadata
title="Contact"
og={{
title: 'Resume',
type: 'website',
url: routes.resume(),
}}
/>
<Resume resume={resume} /> <Resume resume={resume} />
</>
) )

View File

@ -1,7 +1,5 @@
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import { Metadata } from '@redwoodjs/web'
import ContactCardCell from 'src/components/ContactCard/ContactCardCell' import ContactCardCell from 'src/components/ContactCard/ContactCardCell'
const ContactPage = () => { const ContactPage = () => {
@ -29,13 +27,9 @@ const ContactPage = () => {
}, [width, height]) }, [width, height])
return ( return (
<>
<Metadata title="Contact" />
<div className="flex min-h-[calc(100vh-6rem)] items-center justify-center"> <div className="flex min-h-[calc(100vh-6rem)] items-center justify-center">
<ContactCardCell /> <ContactCardCell />
</div> </div>
</>
) )
} }

View File

@ -10,7 +10,15 @@ import { getLogoComponent } from 'src/lib/handle'
const HomePage = () => ( const HomePage = () => (
<> <>
<Metadata title="Home" /> <Metadata
title="Home"
og={{
title: `${process.env.FIRST_NAME} ${process.env.LAST_NAME}`,
description: 'Check out my portfolio!',
type: 'website',
url: routes.home(),
}}
/>
<div className="hero min-h-[calc(100vh-6rem)]"> <div className="hero min-h-[calc(100vh-6rem)]">
<div className="hero-content flex flex-col gap-8"> <div className="hero-content flex flex-col gap-8">

View File

@ -1,5 +1,3 @@
import { Metadata } from '@redwoodjs/web'
import ProjectCell from 'src/components/Project/ProjectCell' import ProjectCell from 'src/components/Project/ProjectCell'
interface ProjectPageProps { interface ProjectPageProps {
@ -7,13 +5,7 @@ interface ProjectPageProps {
} }
const ProjectPage = ({ id }: ProjectPageProps) => { const ProjectPage = ({ id }: ProjectPageProps) => {
return ( return <ProjectCell id={id} />
<>
<Metadata title="Project" />
<ProjectCell id={id} />
</>
)
} }
export default ProjectPage export default ProjectPage

View File

@ -1,14 +1,10 @@
import mobile from 'is-mobile' import mobile from 'is-mobile'
import { Metadata } from '@redwoodjs/web'
import ProjectsShowcaseCell from 'src/components/Project/ProjectsShowcaseCell' import ProjectsShowcaseCell from 'src/components/Project/ProjectsShowcaseCell'
const ProjectsPage = () => { const ProjectsPage = () => {
return ( return (
<> <>
<Metadata title="Projects" />
<div className="hero min-h-64"> <div className="hero min-h-64">
<div className="hero-content"> <div className="hero-content">
<div className="max-w-md text-center"> <div className="max-w-md text-center">

View File

@ -1,15 +1,7 @@
import { Metadata } from '@redwoodjs/web'
import ResumeCell from 'src/components/Resume/ResumeCell' import ResumeCell from 'src/components/Resume/ResumeCell'
const ResumePage = () => { const ResumePage = () => {
return ( return <ResumeCell />
<>
<Metadata title="Resume" />
<ResumeCell />
</>
)
} }
export default ResumePage export default ResumePage