{"record":{"id":"19f868de8d535be8","repo":"TryGhost/Ghost","slug":"the-url-must-be-in-a-format-like-https-www-faceb","errorCode":null,"errorMessage":"The URL must be in a format like https://www.facebook.com/yourPage","messagePattern":"The URL must be in a format like https://www\\.facebook\\.com/yourPage","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"apps/admin/src/settings/app/utils/social-urls/facebook.ts","lineNumber":3,"sourceCode":"import {createPlatformValidator} from './platform-validator';\n\nconst ERROR_MESSAGE = 'The URL must be in a format like https://www.facebook.com/yourPage';\n\n// Facebook is deliberately the loosest platform: pages, groups, people/… and\n// profile.php?id=… are all valid profile locations, so the whole path (query\n// string included) is the stored handle and the only rule is \"no whitespace\".\nconst facebook = createPlatformValidator({\n    domains: ['facebook.com'],\n    www: true,\n    fullPath: true,\n    pathTypes: [\n        {urlPrefix: '', storagePrefix: '', rule: {patterns: [/^\\S+$/]}}\n    ],\n    errors: {\n        invalidUrl: ERROR_MESSAGE,\n        invalidUsername: ERROR_MESSAGE\n    }\n});\n\nexport const validateFacebookUrl = facebook.validate;","sourceCodeStart":1,"sourceCodeEnd":21,"githubUrl":"https://github.com/TryGhost/Ghost/blob/47d8b0e2ad2fd4757d3bc45f46c3ac165ff8a1fe/apps/admin/src/settings/app/utils/social-urls/facebook.ts#L1-L21","documentation":"Thrown by the platform-validator engine for the Facebook definition when input is URL-shaped but can't be resolved to a valid facebook.com profile/page URL. Message declared in facebook.ts ('The URL must be in a format like https://www.facebook.com/yourPage'); thrown in platform-validator.ts at: URL regex non-match (line 227 — wrong domain), no path-type match or empty remainder (line 233 — fullPath mode captures everything after facebook.com/, but an empty path 'https://www.facebook.com/' still throws), or built URL failing validator.isURL (line 263). Facebook uses fullPath: true so the whole path (including query) becomes the handle, and the only username rule is /^\\S+$/ (no whitespace).","triggerScenarios":"Input is URL-shaped but: the domain isn't facebook.com; the path after facebook.com/ is empty; the captured full path contains whitespace (fails /^\\S+$/); or the built canonical URL fails validator.isURL. Because fullPath is true, pages/…, groups/…, people/…, and profile.php?id=… are all accepted as long as there's no whitespace.","commonSituations":"User entered a URL for a different platform; user typed 'https://www.facebook.com/' with no page identifier; user pasted a URL that contained a space (e.g. from a wrapped line); built canonical URL rejected by validator.isURL due to unusual characters.","solutions":["Use a full facebook.com URL with a page/profile identifier, e.g. https://www.facebook.com/yourPage or https://www.facebook.com/profile.php?id=123.","Ensure the domain is facebook.com (www. optional, accepted and kept).","Remove any whitespace from the pasted URL — the only username rule for Facebook is no-whitespace.","For non-throwing checks, use the platform's urlToHandle which returns null on invalid input."],"exampleFix":"// before — throws on empty-path or wrong-domain URL\nconst normalized = validateFacebookUrl(value);\n\n// after — strip whitespace, non-throwing pre-check, then validate\nconst trimmed = value.trim().replace(/\\s+/g, '');\ntry {\n    if (trimmed && trimmed.includes('://') && facebookUrlToHandle(trimmed) === null) {\n        setFieldError('facebook', 'Use a full https://www.facebook.com/yourPage URL');\n    } else {\n        setNormalized(validateFacebookUrl(trimmed));\n    }\n} catch (e) {\n    setFieldError('facebook', e instanceof Error ? e.message : 'Invalid Facebook URL');\n}","handlingStrategy":"try-catch","validationCode":"// Non-throwing pre-check + whitespace strip\nimport {facebookUrlToHandle} from './facebook';\nfunction looksLikeFacebookUrl(input: string): boolean {\n    if (!input || !input.includes('://')) return true;\n    return facebookUrlToHandle(input) !== null;\n}","typeGuard":"null","tryCatchPattern":"const cleaned = value.trim().replace(/\\s+/g, '');\ntry {\n    const normalized = validateFacebookUrl(cleaned);\n} catch (e) {\n    setFieldError('facebook', e instanceof Error ? e.message : 'Invalid Facebook URL');\n}","preventionTips":["Use a full facebook.com URL with a page/profile identifier.","Ensure the path after facebook.com/ isn't empty.","Remove whitespace from pasted URLs — the only Facebook username rule is /^\\S+$/.","Use facebookUrlToHandle for non-throwing URL checks."],"tags":["facebook","social-urls","validation"],"backgroundTag":null,"analyzedSha":"47d8b0e2ad2fd4757d3bc45f46c3ac165ff8a1fe","analyzedAt":"2026-08-13T01:25:26.651Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}