Skip to content

Commit

Permalink
Merge pull request #1443 from tubone24/ogp
Browse files Browse the repository at this point in the history
netlify blobを使って保存
  • Loading branch information
tubone24 committed Mar 16, 2024
2 parents 047b9aa + 2994e84 commit db24fbb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions functions/src/ogp.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Sentry.init({
profilesSampleRate: 1.0,
});

exports.config = {
path: "/functions/ogp.png",
};

const transaction = Sentry.startTransaction({
op: "blog",
name: "ogp transaction",
Expand Down
4 changes: 2 additions & 2 deletions src/components/SEO/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe("SEO", () => {
expect(twitterTitle).toBe("testTitle");
expect(twitterDescription).toBe("testDescription");
expect(twitterImage).toBe(
"https://blog.tubone-project24.xyz/.netlify/functions/ogp?title=testTitle"
"https://blog.tubone-project24.xyz/ogp.png?title=testTitle"
);
});
it("should render metadata (not article)", () => {
Expand Down Expand Up @@ -169,7 +169,7 @@ describe("SEO", () => {
expect(twitterCreator).toBe("@meitante1conan");
expect(twitterDescription).toBe("testDescription");
expect(twitterImage).toBe(
"https://blog.tubone-project24.xyz/.netlify/functions/ogp?title=testTitle"
"https://blog.tubone-project24.xyz/ogp.png?title=testTitle"
);
});
});
2 changes: 1 addition & 1 deletion src/components/SEO/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const SEO = ({
isPost,
tag,
}: Props) => {
const ogpImageLink = `https://blog.tubone-project24.xyz/.netlify/functions/ogp?title=${encodeURI(
const ogpImageLink = `https://blog.tubone-project24.xyz/ogp.png?title=${encodeURI(
title
)}`;
return (
Expand Down
1 change: 1 addition & 0 deletions static/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/sitemap.xml /sitemap-index.xml 301
/latest/meta-data/ / 301
/.well-known/security.txt /well-known/security.txt 301
/ogp.png /.netlify/functions/ogp 200

0 comments on commit db24fbb

Please sign in to comment.