@@ -25,7 +25,8 @@ type SerpData = {
2525}
2626
2727type SerpOverflow = {
28- titleOverflow : boolean
28+ titleOverflowDesktop : boolean
29+ titleOverflowMobile : boolean
2930 descriptionOverflow : boolean
3031 descriptionOverflowMobile : boolean
3132}
@@ -64,8 +65,8 @@ const COMMON_CHECKS: Array<SerpCheck> = [
6465 } ,
6566 {
6667 message :
67- ' The title is wider than 600px and it may not be displayed in full length.' ,
68- hasIssue : ( _ , overflow ) => overflow . titleOverflow ,
68+ ` The title is wider than ${ DESKTOP_TITLE_MAX_WIDTH_PX } px and it may not be displayed in full length.` ,
69+ hasIssue : ( _ , overflow ) => overflow . titleOverflowDesktop ,
6970 } ,
7071]
7172
@@ -85,6 +86,10 @@ const SERP_PREVIEWS: Array<SerpPreview> = [
8586 label : 'Mobile preview' ,
8687 isMobile : true ,
8788 extraChecks : [
89+ {
90+ message : `The title is wider than ${ MOBILE_TITLE_MAX_WIDTH_PX } px and may be trimmed in the mobile preview.` ,
91+ hasIssue : ( _ , overflow ) => overflow . titleOverflowMobile ,
92+ } ,
8893 {
8994 message :
9095 'Description exceeds the 3-line limit for mobile view. Please shorten your text to fit within 3 lines.' ,
@@ -326,8 +331,10 @@ function getSerpPreviewState(data: SerpData): SerpPreviewState {
326331 DESCRIPTION_FONT ,
327332 ) ,
328333 overflow : {
329- titleOverflow :
334+ titleOverflowDesktop :
330335 measureTextWidth ( titleText , TITLE_FONT ) > DESKTOP_TITLE_MAX_WIDTH_PX ,
336+ titleOverflowMobile :
337+ measureTextWidth ( titleText , TITLE_FONT ) > MOBILE_TITLE_MAX_WIDTH_PX ,
331338 descriptionOverflow :
332339 desktopDescriptionLines . length > DESKTOP_DESCRIPTION_MAX_LINES ||
333340 desktopDescriptionLines . reduce (
@@ -404,11 +411,17 @@ export function getSerpPreviewSummary(): SeoSectionSummary {
404411 message : 'No meta description set on the page.' ,
405412 } )
406413 }
407- if ( overflow . titleOverflow ) {
414+ if ( overflow . titleOverflowDesktop ) {
408415 issues . push ( {
409416 severity : 'warning' ,
410417 message :
411- 'The title is wider than 600px and it may not be displayed in full length.' ,
418+ `The title is wider than ${ DESKTOP_TITLE_MAX_WIDTH_PX } px and it may not be displayed in full length.` ,
419+ } )
420+ }
421+ if ( overflow . titleOverflowMobile ) {
422+ issues . push ( {
423+ severity : 'warning' ,
424+ message : `The title is wider than ${ MOBILE_TITLE_MAX_WIDTH_PX } px and may be trimmed in the mobile preview.` ,
412425 } )
413426 }
414427 if ( overflow . descriptionOverflow ) {
0 commit comments