Skip to content

Commit

Permalink
Fix OG image
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillkurko committed Mar 13, 2024
1 parent f2a1da1 commit d5b7b8c
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 11 deletions.
4 changes: 3 additions & 1 deletion src/app/about/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { PageTitle, Paragraph } from '@components/typography';
import AboutCard from './AboutCard';
import type { Metadata } from 'next';
import { BASE_URL } from '../../utils/conts';
import { BASE_URL } from '../../utils/const';
import { OG_IMAGE } from '../../utils/ogImage';

interface Feedback {
avatar: string;
Expand Down Expand Up @@ -78,6 +79,7 @@ export const metadata: Metadata = {
'Learn more about me through the words of some of my close friends, managers and peers.',
openGraph: {
url: new URL(`${BASE_URL}/about`),
images: [OG_IMAGE],
},
};

Expand Down
4 changes: 3 additions & 1 deletion src/app/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { Mdx } from '@components/mdx';
import { allBlogs } from '@contentlayer/generated';
import { type Metadata } from 'next';
import ViewTracker from './ViewTracker';
import { BASE_URL } from '../../../utils/conts';
import { BASE_URL } from '../../../utils/const';
import { OG_IMAGE } from '../../../utils/ogImage';

export async function generateMetadata({ params }: Props): Promise<Metadata> {
const { slug } = params;
Expand All @@ -14,6 +15,7 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
description: blogPost?.summary,
openGraph: {
url: new URL(`${BASE_URL}/blog/${slug}`),
images: [OG_IMAGE],
},
};
}
Expand Down
4 changes: 3 additions & 1 deletion src/app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { PageTitle, Paragraph, SectionTitle } from '@components/typography';
import ArticlePreview from '@components/ArticlePreview';
import { type Metadata } from 'next';
import { getAllBlogPosts } from '@lib/models/blog';
import { BASE_URL } from '../../utils/conts';
import { BASE_URL } from '../../utils/const';
import { OG_IMAGE } from '../../utils/ogImage';

export const revalidate = 0;

Expand All @@ -12,6 +13,7 @@ export const metadata: Metadata = {
'Weekly content about software development and management. All articles are based on my own experience and real cases.',
openGraph: {
url: new URL(`${BASE_URL}/blog`),
images: [OG_IMAGE],
},
};

Expand Down
4 changes: 3 additions & 1 deletion src/app/emoji/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import Emoji from './Emoji';
import { PageTitle, Paragraph } from '@components/typography';
import { getAllEmojis } from '@lib/models/emoji';
import { type Metadata } from 'next';
import { BASE_URL } from '../../utils/conts';
import { BASE_URL } from '../../utils/const';
import { OG_IMAGE } from '../../utils/ogImage';

export const revalidate = 0;

Expand All @@ -11,6 +12,7 @@ export const metadata: Metadata = {
description: 'Here you can have fun and vote for your favorite emoji.',
openGraph: {
url: new URL(`${BASE_URL}/emoji`),
images: [OG_IMAGE],
},
};

Expand Down
4 changes: 3 additions & 1 deletion src/app/gallery/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import WorkInProgress from '@components/WorkInProgress';
import type { Metadata } from 'next';
import { BASE_URL } from '../../utils/conts';
import { BASE_URL } from '../../utils/const';
import { OG_IMAGE } from '../../utils/ogImage';

export const metadata: Metadata = {
title: 'Gallery',
description:
'I like photography and here are a couple of my favorite pictures.',
openGraph: {
url: new URL(`${BASE_URL}/gallery`),
images: [OG_IMAGE],
},
};

Expand Down
4 changes: 2 additions & 2 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Analytics } from '@vercel/analytics/react';
import type { Metadata } from 'next';
import Container from '@components/Container';
import './globals.css';
import { BASE_URL } from '../utils/conts';
import { BASE_URL } from '../utils/const';

const redHatText = Red_Hat_Text({
variable: '--font-red-hat-text',
Expand All @@ -29,7 +29,7 @@ export const metadata: Metadata = {
alternates: {
canonical: './',
},
metadataBase: new URL(BASE_URL),
metadataBase: new URL(`${BASE_URL}/`),
};

interface Props {
Expand Down
4 changes: 3 additions & 1 deletion src/app/newsletter/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import WorkInProgress from '@components/WorkInProgress';
import type { Metadata } from 'next';
import { BASE_URL } from '../../utils/conts';
import { BASE_URL } from '../../utils/const';
import { OG_IMAGE } from '../../utils/ogImage';

export const metadata: Metadata = {
title: 'Newsletter',
description: 'Follow my newsletter on software development and management.',
openGraph: {
url: new URL(`${BASE_URL}/newsletter`),
images: [OG_IMAGE],
},
};

Expand Down
4 changes: 3 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { PageTitle, Paragraph } from '@components/typography';
import type { Metadata } from 'next';
import { BASE_URL } from '../utils/conts';
import { BASE_URL } from '../utils/const';
import { OG_IMAGE } from '../utils/ogImage';

export const metadata: Metadata = {
title: 'kkurko.dev',
description: 'Frontend Developer and Penguin 🐧',
openGraph: {
url: new URL(BASE_URL),
images: [OG_IMAGE],
},
};

Expand Down
4 changes: 3 additions & 1 deletion src/app/snippets/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import WorkInProgress from '@components/WorkInProgress';
import type { Metadata } from 'next';
import { BASE_URL } from '../../utils/conts';
import { BASE_URL } from '../../utils/const';
import { OG_IMAGE } from '../../utils/ogImage';

export const metadata: Metadata = {
title: 'Snippets',
description:
'Short code snippets that I found useful and want to keep at hand.',
openGraph: {
url: new URL(`${BASE_URL}/snippets`),
images: [OG_IMAGE],
},
};

Expand Down
1 change: 1 addition & 0 deletions src/utils/const.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const BASE_URL = 'https://kkurko.dev';
1 change: 0 additions & 1 deletion src/utils/conts.ts

This file was deleted.

7 changes: 7 additions & 0 deletions src/utils/ogImage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import ogImage from '../app/opengraph-image.png';

export const OG_IMAGE = {
url: ogImage.src,
width: ogImage.width,
height: ogImage.height,
};

0 comments on commit d5b7b8c

Please sign in to comment.