Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tubone24 committed Mar 16, 2024
1 parent 2994e84 commit 6d653c2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
9 changes: 7 additions & 2 deletions src/__generated__/gatsby-types.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions src/components/SEO/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type Props = {
siteTitleAlt: string;
isPost: boolean;
image: string;
ogpImage?: string;
tag: string;
description: string;
};
Expand Down Expand Up @@ -94,13 +95,11 @@ const SEO = ({
title = config.siteTitle,
description,
image,
ogpImage,
siteTitleAlt,
isPost,
tag,
}: Props) => {
const ogpImageLink = `https://blog.tubone-project24.xyz/ogp.png?title=${encodeURI(
title
)}`;
return (
<Helmet>
<title>{title}</title>
Expand Down Expand Up @@ -142,7 +141,7 @@ const SEO = ({
<meta name="twitter:creator" content="@meitante1conan" />
<meta name="twitter:title" content={title} />
<meta name="twitter:description" content={description} />
<meta name="twitter:image" content={ogpImageLink} />
<meta name="twitter:image" content={ogpImage || image} />
</Helmet>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ tags:
- Deno DOM
- ptera
headerImage: https://i.imgur.com/FO7l5lW.png
ogpImage: https://i.imgur.com/R4WlvEE.png
templateKey: blog-post
---

Expand Down Expand Up @@ -225,4 +226,3 @@ Viewを変更することでカレンダー表示にもできます。(使い
妻からもよいフィードバックが!!!やったやったー!!!

![img](https://i.imgur.com/vzyD8Iu.png)

7 changes: 7 additions & 0 deletions src/templates/blog-post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ class BlogPost extends Component<Props> {
tag={frontmatter?.tags ? frontmatter.tags[0] || "" : ""}
description={excerpt || ""}
image={frontmatter?.headerImage || config.defaultImage || ""}
ogpImage={
frontmatter?.ogpImage ||

Check failure on line 89 in src/templates/blog-post.tsx

View workflow job for this annotation

GitHub Actions / lint

Property 'ogpImage' does not exist on type 'Pick<MarkdownRemarkFrontmatter, "id" | "title" | "headerImage" | "date" | "tags" | "slug">'.
frontmatter?.headerImage ||
config.defaultImage ||
""
}
/>
</div>
);
Expand All @@ -102,6 +108,7 @@ export const pageQuery = graphql`
slug
date
headerImage
ogpImage
tags
}
}
Expand Down

0 comments on commit 6d653c2

Please sign in to comment.