Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/keepsimple_/assets/longevity/og.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions src/components/SeoGenerator/SeoGenerator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface SeoGeneratorProps {
localizedSlug?: any;
modifiedDate?: string;
createdDate?: string;
isLongevityPage?: boolean;
ogTags?: {
ogDescription: string;
ogTitle: string;
Expand All @@ -38,6 +39,7 @@ const SeoGenerator: FC<SeoGeneratorProps> = ({
createdDate,
modifiedDate,
localizedSlug,
isLongevityPage,
}) => {
const router = useRouter();

Expand Down Expand Up @@ -224,7 +226,9 @@ const SeoGenerator: FC<SeoGeneratorProps> = ({
property="og:image"
content={
ogTags?.ogImage?.data?.attributes?.url
? `${process.env.NEXT_PUBLIC_STRAPI}${ogTags?.ogImage?.data?.attributes?.url}`
? isLongevityPage
? ogTags?.ogImage?.data?.attributes?.url
: `${process.env.NEXT_PUBLIC_STRAPI}${ogTags?.ogImage?.data?.attributes?.url}`
: ogTags?.ogImage?.data?.attributes?.staticUrl
}
/>
Expand Down Expand Up @@ -254,7 +258,9 @@ const SeoGenerator: FC<SeoGeneratorProps> = ({
name="twitter:image"
content={
ogTags?.ogImage?.data?.attributes?.url
? `${process.env.NEXT_PUBLIC_STRAPI}${ogTags?.ogImage?.data?.attributes?.url}`
? isLongevityPage
? ogTags?.ogImage?.data?.attributes?.url
: `${process.env.NEXT_PUBLIC_STRAPI}${ogTags?.ogImage?.data?.attributes?.url}`
: ogTags?.ogImage?.data?.attributes?.staticUrl
}
/>
Expand Down
5 changes: 3 additions & 2 deletions src/constants/longevity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ export const longevityDietPath = '/keepsimple_/assets/longevity/diet';
const heartsPath = '/keepsimple_/assets/longevity/diet/hearts/';
const scaleImgPath = '/keepsimple_/assets/longevity/diet/diet-results-icons/';
const backgroundImgPath = '/keepsimple_/assets/longevity/diet/diet-results-bg/';

const domain = process.env.NEXT_PUBLIC_DOMAIN;
export const ogImage = `${domain}/keepsimple_/assets/longevity/og.png`;
export const images = [
`${heartsPath}sugar.svg`,
`${heartsPath}seed-oil.svg`,
Expand Down Expand Up @@ -144,7 +145,7 @@ export const ACTIVITY_LEVEL_SUMMARY = [
minutes: 300,
riskOfDyingEarly: '65% of early-death risk',
cognitiveDecline: '~25–35% lower',
brainAgingActive: 'Optimized (use brain-age model)',
brainAgingActive: 'Optimized',
brainAgingSedentary: 'Worst-case brain-age path',
},
];
4 changes: 3 additions & 1 deletion src/pages/tools/longevity-protocol/about-project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { getWhatIsThis } from '@api/longevity/what-is-this';
import SeoGenerator from '@components/SeoGenerator';

import WhatIsThisLayout from '@layouts/LongevityLayouts';
import { ogImage } from '@constants/longevity';

const AboutProject = ({ aboutTheProject }) => {
const OGTags = {
Expand All @@ -14,7 +15,7 @@ const AboutProject = ({ aboutTheProject }) => {
ogImage: {
data: {
attributes: {
url: aboutTheProject['en']?.ogImage?.data?.attributes?.url || '',
url: ogImage,
},
},
},
Expand All @@ -29,6 +30,7 @@ const AboutProject = ({ aboutTheProject }) => {
title: aboutTheProject['en']?.Seo?.pageTitle || '',
seoTitle: aboutTheProject['en']?.Seo?.seoTitle || '',
}}
isLongevityPage
ogTags={OGTags}
createdDate={aboutTheProject['en']?.createdAt || ''}
modifiedDate={aboutTheProject['en']?.updatedAt || ''}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/tools/longevity-protocol/environment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import EnvironmentLayout from '@layouts/EnvironmentLayout/EnvironmentLayout';

import { getEnvironment } from '@api/longevity/environment';
import SeoGenerator from '@components/SeoGenerator';
import { ogImage } from '@constants/longevity';

const Environment = ({ environment }) => {
const router = useRouter();
Expand All @@ -18,7 +19,7 @@ const Environment = ({ environment }) => {
ogImage: {
data: {
attributes: {
url: environment['en']?.ogImage?.data?.attributes?.url || '',
url: ogImage,
},
},
},
Expand All @@ -33,6 +34,7 @@ const Environment = ({ environment }) => {
title: environment['en']?.Seo?.pageTitle || '',
seoTitle: environment['en']?.Seo?.seoTitle || '',
}}
isLongevityPage
ogTags={OGTags}
createdDate={environment['en']?.createdAt || ''}
modifiedDate={environment['en']?.updatedAt || ''}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/tools/longevity-protocol/habits/diet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import DietLayout from '@layouts/DietLayout';

import { getDiet } from '@api/longevity/diet';
import SeoGenerator from '@components/SeoGenerator';
import { ogImage } from '@constants/longevity';

const Diet = ({ dietData }) => {
const OGTags = {
Expand All @@ -14,7 +15,7 @@ const Diet = ({ dietData }) => {
ogImage: {
data: {
attributes: {
url: dietData['en']?.ogImage?.data?.attributes?.url || '',
url: ogImage,
},
},
},
Expand All @@ -29,6 +30,7 @@ const Diet = ({ dietData }) => {
title: dietData['en']?.Seo?.seoTitle || '',
seoTitle: dietData['en']?.Seo?.seoTitle || '',
}}
isLongevityPage
ogTags={OGTags}
createdDate={dietData['en']?.createdAt || ''}
modifiedDate={dietData['en']?.updatedAt || ''}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/tools/longevity-protocol/habits/lifestyle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import HabitsLayout from '@layouts/HabitsLayout/HabitsLayout';

import { getHabitsProtocol } from '@api/longevity/habits-protocol';
import SeoGenerator from '@components/SeoGenerator';
import { ogImage } from '@constants/longevity';

const Lifestyle = ({ habitsData }) => {
const OGTags = {
Expand All @@ -14,7 +15,7 @@ const Lifestyle = ({ habitsData }) => {
ogImage: {
data: {
attributes: {
url: habitsData['en']?.ogImage?.data?.attributes?.url || '',
url: ogImage,
},
},
},
Expand All @@ -29,6 +30,7 @@ const Lifestyle = ({ habitsData }) => {
title: habitsData['en']?.Seo?.pageTitle || '',
seoTitle: habitsData['en']?.Seo?.seoTitle || '',
}}
isLongevityPage
ogTags={OGTags}
createdDate={habitsData['en']?.createdAt || ''}
modifiedDate={habitsData['en']?.updatedAt || ''}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/tools/longevity-protocol/habits/sleep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { getSleepSupplements } from '@api/longevity/sleep-supplements';

import SleepLayout from '@layouts/SleepLayout/SleepLayout';
import SeoGenerator from '@components/SeoGenerator';
import { ogImage } from '@constants/longevity';

const Sleep = ({ sleepData, sleepSupplements }) => {
const OGTags = {
Expand All @@ -15,7 +16,7 @@ const Sleep = ({ sleepData, sleepSupplements }) => {
ogImage: {
data: {
attributes: {
url: sleepData['en']?.ogImage?.data?.attributes?.url || '',
url: ogImage,
},
},
},
Expand All @@ -30,6 +31,7 @@ const Sleep = ({ sleepData, sleepSupplements }) => {
title: sleepData['en']?.Seo?.pageTitle || '',
seoTitle: sleepData['en']?.Seo?.seoTitle || '',
}}
isLongevityPage
ogTags={OGTags}
createdDate={sleepData['en']?.createdAt || ''}
modifiedDate={sleepData['en']?.updatedAt || ''}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/tools/longevity-protocol/habits/study.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import StudyLayout from '@layouts/StudyLayout';

import { getStudy } from '@api/longevity/study';
import SeoGenerator from '@components/SeoGenerator';
import { ogImage } from '@constants/longevity';

const Study = ({ studyData }) => {
const OGTags = {
Expand All @@ -14,7 +15,7 @@ const Study = ({ studyData }) => {
ogImage: {
data: {
attributes: {
url: studyData['en']?.ogImage?.data?.attributes?.url || '',
url: ogImage,
},
},
},
Expand All @@ -29,6 +30,7 @@ const Study = ({ studyData }) => {
title: studyData['en']?.Seo?.pageTitle || '',
seoTitle: studyData['en']?.Seo?.seoTitle || '',
}}
isLongevityPage
ogTags={OGTags}
createdDate={studyData['en']?.createdAt || ''}
modifiedDate={studyData['en']?.updatedAt || ''}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/tools/longevity-protocol/habits/supplements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import SupplementsLayout from '@layouts/Supplements';

import { getSupplements } from '@api/longevity/supplements';
import SeoGenerator from '@components/SeoGenerator';
import { ogImage } from '@constants/longevity';

const Supplements = ({ supplements }) => {
const OGTags = {
Expand All @@ -14,7 +15,7 @@ const Supplements = ({ supplements }) => {
ogImage: {
data: {
attributes: {
url: supplements['en']?.ogImage?.data?.attributes?.url || '',
url: ogImage,
},
},
},
Expand All @@ -29,6 +30,7 @@ const Supplements = ({ supplements }) => {
title: supplements['en']?.Seo?.pageTitle || '',
seoTitle: supplements['en']?.Seo?.seoTitle || '',
}}
isLongevityPage
ogTags={OGTags}
createdDate={supplements['en']?.createdAt || ''}
modifiedDate={supplements['en']?.updatedAt || ''}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/tools/longevity-protocol/habits/workout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import WorkoutLayout from '@layouts/WorkoutLayout/WorkoutLayout';

import { getWorkout } from '@api/longevity/workout';
import SeoGenerator from '@components/SeoGenerator';
import { ogImage } from '@constants/longevity';

const Workout = ({ workoutData }) => {
const OGTags = {
Expand All @@ -14,7 +15,7 @@ const Workout = ({ workoutData }) => {
ogImage: {
data: {
attributes: {
url: workoutData['en']?.ogImage?.data?.attributes?.url || '',
url: ogImage,
},
},
},
Expand All @@ -29,6 +30,7 @@ const Workout = ({ workoutData }) => {
title: workoutData['en']?.Seo?.pageTitle || '',
seoTitle: workoutData['en']?.Seo?.seoTitle || '',
}}
isLongevityPage
ogTags={OGTags}
createdDate={workoutData['en']?.createdAt || ''}
modifiedDate={workoutData['en']?.updatedAt || ''}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/tools/longevity-protocol/results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ResultsLayout from '@layouts/ResultsLayout';

import { getLongevityResults } from '@api/longevity/results';
import SeoGenerator from '@components/SeoGenerator';
import { ogImage } from '@constants/longevity';

const Results = ({ yearlyResults }) => {
const OGTags = {
Expand All @@ -14,7 +15,7 @@ const Results = ({ yearlyResults }) => {
ogImage: {
data: {
attributes: {
url: yearlyResults['en']?.ogImage?.data?.attributes?.url || '',
url: ogImage,
},
},
},
Expand All @@ -29,6 +30,7 @@ const Results = ({ yearlyResults }) => {
title: yearlyResults['en']?.Seo?.pageTitle,
seoTitle: yearlyResults['en']?.Seo?.seoTitle,
}}
isLongevityPage
ogTags={OGTags}
createdDate={yearlyResults['en']?.createdAt}
modifiedDate={yearlyResults['en']?.updatedAt}
Expand Down