@@ -110,6 +110,7 @@ const HomeOGImage: FC<AggregateRoot> = ({ seo, user: { avatar } }) => {
110
110
</ div >
111
111
)
112
112
}
113
+
113
114
export const GET = async ( req : NextRequest ) => {
114
115
try {
115
116
const { searchParams } = req . nextUrl
@@ -167,7 +168,7 @@ export const GET = async (req: NextRequest) => {
167
168
break
168
169
}
169
170
}
170
- const { title , subtitle } = document
171
+ const { subtitle , title } = document
171
172
172
173
const {
173
174
user : { avatar } ,
@@ -196,21 +197,22 @@ export const GET = async (req: NextRequest) => {
196
197
} ) . color
197
198
198
199
let canShownTitle = ''
199
- let leftContainerWidth = 1200
200
+
201
+ let leftContainerWidth = 1100
200
202
for ( let i = 0 ; i < title . length ; i ++ ) {
201
203
if ( leftContainerWidth < 0 ) break
202
- // cjk 字符算 67.2 px
204
+ // cjk 字符算 64 px
203
205
const char = title [ i ]
204
206
// char 不能是 emoji
205
207
if ( ( char >= '\u4e00' && char <= '\u9fa5' ) || char === ' ' ) {
206
- leftContainerWidth -= 67.2
208
+ leftContainerWidth -= 64
207
209
canShownTitle += char
208
210
} else if ( char >= '\u0000' && char <= '\u00ff' ) {
209
- // latin 字符算 33.6 px
210
- leftContainerWidth -= 33.6
211
+ // latin 字符算 40px
212
+ leftContainerWidth -= 40
211
213
canShownTitle += char
212
214
} else {
213
- leftContainerWidth -= 67.2
215
+ leftContainerWidth -= 64
214
216
canShownTitle += char
215
217
}
216
218
}
@@ -226,9 +228,9 @@ export const GET = async (req: NextRequest) => {
226
228
background : `linear-gradient(37deg, ${ bgAccent } 27.82%, ${ bgAccentLight } 79.68%, ${ bgAccentUltraLight } 100%)` ,
227
229
228
230
// fontFamily: 'LXGWWenKai',
229
- fontFamily : 'Noto Sans, Inter, "Material Icons"' ,
231
+ fontFamily : 'Inter, Noto Sans, Inter, "Material Icons"' ,
230
232
231
- padding : '5rem ' ,
233
+ padding : '50px ' ,
232
234
alignItems : 'flex-end' ,
233
235
justifyContent : 'flex-end' ,
234
236
} }
@@ -276,19 +278,20 @@ export const GET = async (req: NextRequest) => {
276
278
style = { {
277
279
color : 'rgba(255, 255, 255, 0.92)' ,
278
280
279
- fontSize : '4.2rem' ,
281
+ fontSize : ` ${ ( canShownTitle . length / title . length ) * 64 } px` ,
280
282
whiteSpace : 'nowrap' ,
281
283
textOverflow : 'ellipsis' ,
282
284
WebkitLineClamp : 1 ,
283
285
lineClamp : 1 ,
284
286
} }
285
287
>
286
- { canShownTitle }
288
+ { title }
287
289
</ h1 >
288
290
< h2
289
291
style = { {
290
- color : 'rgba(230, 230, 230, 0.85)' ,
291
- fontSize : '3rem' ,
292
+ color : 'rgba(255, 255, 255, 0.85)' ,
293
+ fontSize : '38px' ,
294
+ fontWeight : 300 ,
292
295
} }
293
296
>
294
297
{ subtitle }
0 commit comments