Skip to content

Commit

Permalink
feat: change openGraph helper to og link
Browse files Browse the repository at this point in the history
  • Loading branch information
theodorusclarence committed Oct 15, 2021
1 parent 2a49e71 commit af05eb2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ export function classNames(...classes: string[]): string {
export function openGraph(
title: string,
description: string,
logo = 'https://theodorusclarence.com/favicon/large-og.jpg'
logo = 'https://og.thcl.dev/images/logo.jpg'
): string {
const ogLogo = encodeURIComponent(logo);
const ogTitle = encodeURIComponent(title.trim());
const ogDesc = encodeURIComponent(description.trim());
return `https://og-image.vercel.app/%3Cdiv%20style%3D%27position%3A%20absolute%3B%20inset%3A%200%3B%20background%3A%20%23222%3B%20color%3A%20white%3B%20display%3A%20flex%3B%20align-items%3Acenter%3B%20justify-content%3Acenter%3B%20flex-direction%3A%20column%3B%27%3E%0A%20%20%3Cimg%20src%3D%22${ogLogo}%22%20alt%3D%22Favicon%22%20style%3D%27max-width%3A%20180px%27%3E%0A%20%20%3Ch3%20style%3D%27margin%3A%200%3Bmargin-top%3A1rem%3B%27%3E${ogTitle}%3C%2Fh3%3E%0A%20%20%3Cp%20style%3D%22margin%3A%200%3B%20margin-top%3A0.5rem%3B%20font-size%3A3rem%3B%20max-width%3A%2070%25%3B%22%3E%3Csmaller%3E${ogDesc}%3C%2Fsmaller%3E%3C%2Fp%3E%0A%3C%2Fdiv%3E.png?theme=dark&md=1&fontSize=75px&images=https://assets.vercel.com/image/upload/front/assets/design/vercel-triangle-white.svg`;
return `https://og.thcl.dev/api/general?title=${ogTitle}&description=${ogDesc}&logo=${ogLogo}`;
}

1 comment on commit af05eb2

@vercel
Copy link

@vercel vercel bot commented on af05eb2 Oct 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.