Skip to content

Commit

Permalink
Merge pull request #15 from cpbitmap/addExplicitImageUrl
Browse files Browse the repository at this point in the history
Add explicit imageUrl and add author to MetaTags
  • Loading branch information
ainsleyrutterford authored Dec 2, 2023
2 parents 44b53a1 + 078b554 commit c58262c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 15 additions & 3 deletions components/MetaTags/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@ import React from "react";

type MetaTagsProps = {
siteUrl: string;
// It is safer to have a complete the image URL rather than a relative one
imageUrl: string;
title: string;
description: string;
author: string;
};

const MetaTags = ({ siteUrl, title, description }: MetaTagsProps) => (
const MetaTags = ({
siteUrl,
imageUrl,
title,
description,
author,
}: MetaTagsProps) => (
<>
{/* Social media card tags. Generated with https://metatags.io: */}
<title>{title}</title>
Expand All @@ -18,14 +27,14 @@ const MetaTags = ({ siteUrl, title, description }: MetaTagsProps) => (
<meta property="og:url" content={siteUrl} />
<meta property="og:title" content={title} />
<meta property="og:description" content={description} />
<meta property="og:image" content="cpbitmap-social-media-card.png" />
<meta property="og:image" content={imageUrl} />

{/* Twitter: */}
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content={siteUrl} />
<meta property="twitter:title" content={title} />
<meta property="twitter:description" content={description} />
<meta property="twitter:image" content="cpbitmap-social-media-card.png" />
<meta property="twitter:image" content={imageUrl} />

{/* Favicon tags. Generated with https://realfavicongenerator.net: */}
<link
Expand Down Expand Up @@ -53,6 +62,9 @@ const MetaTags = ({ siteUrl, title, description }: MetaTagsProps) => (
/>
<meta name="msapplication-TileColor" content="#2b5797" />
<meta name="theme-color" content="#ffffff" />

{/* Other: */}
<meta name="author" content={author}></meta>
</>
);

Expand Down
2 changes: 2 additions & 0 deletions pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ class MyDocument extends Document {
{/* This is the default <head> for all pages across the website. */}
<MetaTags
siteUrl="https://cpbitmap.github.io/"
imageUrl="https://cpbitmap.github.io/cpbitmap-social-media-card.png"
title="CPBitmap Converter"
description="A free online cpbitmap conversion tool. Convert cpbitmap files to PNG, JPEG, or TIFF."
author="Ainsley Rutterford"
/>
</Head>
<body>
Expand Down

0 comments on commit c58262c

Please sign in to comment.