Skip to content

Commit 035e56f

Browse files
committed
Fix text size
1 parent 6791653 commit 035e56f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

utils/getDefaultOgimage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export default function getDefaultOgimage(content) {
22
const encodedTitle = encodeURI(content.title);
3-
const textSize = content.title.length > 22 ? 52 : 60; // 正確な文字数ではないが大体の指標としては十分と判断する
3+
const length = content.title.length;
4+
const textSize = length > 30 ? 42 : length > 22 ? 52 : 60; // 正確な文字数ではないが大体の指標としては十分と判断する
45
return `https://images.blog.microcms.io/assets/f5d83e38f9374219900ef1b0cc4d85cd/92c09085ec6243cca78046fa644dd8cd/banner-bg.png?blend-mode=normal&blend-x=88&blend-align=middle&blend64=${Buffer.from(
56
`https://assets.imgix.net/~text?txtsize=${textSize}&w=672&txtfont=Hiragino%20Sans%20W8&txt-color=212149&txt=${encodedTitle}`,
67
'ascii'

0 commit comments

Comments
 (0)