File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ export default async function OG({
4747
4848 const name = profile ?. name ?? fallback . name ;
4949 const role = profile ?. role ?? fallback . role ;
50+ const displayName = sanitizeForOGText ( name ) ;
51+ const displayRole = sanitizeForOGText ( role ) ;
5052
5153 return new ImageResponse (
5254 (
@@ -125,9 +127,9 @@ export default async function OG({
125127 color : "#ffffff" ,
126128 } }
127129 >
128- { name }
130+ { displayName }
129131 </ div >
130- < div style = { { fontSize : 28 , color : "#b8b3b0" } } > { role } </ div >
132+ < div style = { { fontSize : 28 , color : "#b8b3b0" } } > { displayRole } </ div >
131133 < div
132134 style = { {
133135 fontSize : 22 ,
@@ -171,6 +173,18 @@ export default async function OG({
171173 ) ;
172174}
173175
176+ /**
177+ * Strip combining diacritical marks (U+0300-U+036F) and map Đ/đ to ASCII
178+ * so Next.js OG generation does not trigger remote dynamic-font fetching.
179+ */
180+ function sanitizeForOGText ( value ?: string | null ) {
181+ return ( value ?? "" )
182+ . normalize ( "NFD" )
183+ . replace ( / [ \u0300 - \u036f ] / g, "" )
184+ . replace ( / Đ / g, "D" )
185+ . replace ( / đ / g, "d" ) ;
186+ }
187+
174188function Stat ( { value, label } : { value : string ; label : string } ) {
175189 return (
176190 < div style = { { display : "flex" , flexDirection : "column" , gap : 4 } } >
You can’t perform that action at this time.
0 commit comments