Skip to content

Commit

Permalink
refactor: change links to constant
Browse files Browse the repository at this point in the history
  • Loading branch information
theodorusclarence committed Jan 12, 2022
1 parent bdf1c5b commit 1543e22
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pages/blog/[slug].tsx
Expand Up @@ -49,7 +49,11 @@ export default function SingleBlogPage({
recommendations
);

//#region //*=========== Link Constants ===========
const COMMIT_HISTORY_LINK = `https://github.com/theodorusclarence/theodorusclarence.com/commits/main/src/contents/blog/${frontmatter.slug}.mdx`;
const GITHUB_EDIT_LINK = `https://github.com/theodorusclarence/theodorusclarence.com/blob/main/src/contents/blog/${frontmatter.slug}.mdx`;
const OG_BANNER_LINK = `https://res.cloudinary.com/theodorusclarence/image/upload/f_auto,c_fill,ar_4:5,w_1200/theodorusclarence/banner/${frontmatter.banner}`;
//#endregion //*======== Link Constants ===========

//#region //*=========== Blog Language ===========
const cleanSlug = cleanBlogPrefix(frontmatter.slug);
Expand Down Expand Up @@ -90,7 +94,7 @@ export default function SingleBlogPage({
templateTitle={frontmatter.title}
description={frontmatter.description}
isBlog
banner={`https://res.cloudinary.com/theodorusclarence/image/upload/f_auto,c_fill,ar_4:5,w_1200/theodorusclarence/banner/${frontmatter.banner}`}
banner={OG_BANNER_LINK}
date={new Date(
frontmatter.lastUpdated ?? frontmatter.publishedAt
).toISOString()}
Expand Down Expand Up @@ -236,9 +240,7 @@ export default function SingleBlogPage({
<SubscribeCard className='mt-12' title='Enjoying this post?' />

<div className='flex flex-col gap-4 items-start mt-8 md:flex-row-reverse md:justify-between'>
<CustomLink
href={`https://github.com/theodorusclarence/theodorusclarence.com/blob/main/src/contents/blog/${frontmatter.slug}.mdx`}
>
<CustomLink href={GITHUB_EDIT_LINK}>
Edit this on GitHub
</CustomLink>
<CustomLink href='/blog'>← Back to blog</CustomLink>
Expand Down

1 comment on commit 1543e22

@vercel
Copy link

@vercel vercel bot commented on 1543e22 Jan 12, 2022

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.