{"record":{"id":"474f55ffe65faad1","repo":"TryGhost/Ghost","slug":"the-url-must-be-in-a-format-like-https-www-linke","errorCode":null,"errorMessage":"The URL must be in a format like https://www.linkedin.com/in/yourUsername","messagePattern":"The URL must be in a format like https://www\\.linkedin\\.com/in/yourUsername","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"apps/admin/src/settings/app/utils/social-urls/linkedin.ts","lineNumber":28,"sourceCode":"    min: 3,\n    max: 100\n};\n\n// /in/ profiles are stored as a bare handle; the other path types keep their\n// prefix in storage. Regional subdomains (uk.linkedin.com) are valid input and\n// stay in the validated URL, but are dropped from the stored handle.\nconst linkedin = createPlatformValidator({\n    domains: ['linkedin.com'],\n    www: true,\n    regionalSubdomain: '[a-z]{2}',\n    pathTypes: [\n        {urlPrefix: 'in/', storagePrefix: '', handleAliases: ['in/'], rule: LINKEDIN_USERNAME_RULE},\n        {urlPrefix: 'pub/', storagePrefix: 'pub/', rule: {...LINKEDIN_USERNAME_RULE, nestedSegments: true}},\n        {urlPrefix: 'company/', storagePrefix: 'company/', rule: LINKEDIN_USERNAME_RULE},\n        {urlPrefix: 'school/', storagePrefix: 'school/', rule: LINKEDIN_USERNAME_RULE}\n    ],\n    errors: {\n        invalidUrl: 'The URL must be in a format like https://www.linkedin.com/in/yourUsername',\n        invalidUsername: 'Your Username is not a valid LinkedIn Username'\n    }\n});\n\nexport const validateLinkedInUrl = linkedin.validate;\nexport const linkedinHandleToUrl = linkedin.handleToUrl;\nexport const linkedinUrlToHandle = linkedin.urlToHandle;\n","sourceCodeStart":10,"sourceCodeEnd":36,"githubUrl":"https://github.com/TryGhost/Ghost/blob/47d8b0e2ad2fd4757d3bc45f46c3ac165ff8a1fe/apps/admin/src/settings/app/utils/social-urls/linkedin.ts#L10-L36","documentation":"Thrown by the platform-validator engine for the LinkedIn definition when input is URL-shaped but can't be resolved to a valid linkedin.com profile URL. Message declared in linkedin.ts ('The URL must be in a format like https://www.linkedin.com/in/yourUsername'); thrown in platform-validator.ts at: URL regex non-match (line 227 — wrong domain), no recognised path-type prefix (in/, pub/, company/, school/) or empty remainder (line 233 — e.g. 'https://www.linkedin.com/' with no path), or built URL failing validator.isURL (line 263).","triggerScenarios":"Input is URL-shaped but: the domain isn't linkedin.com (e.g. 'https://facebook.com/in/user'); the path doesn't start with one of in/, pub/, company/, school/ (e.g. 'https://www.linkedin.com/feed'); the path is empty ('https://www.linkedin.com/'); the assembled canonical URL fails validator.isURL. Bare non-URL handles with bad charset route to invalidUsername instead. A regional subdomain (two-letter country code like 'uk.') is captured and kept.","commonSituations":"User pasted a LinkedIn company/feed/post URL instead of a profile URL; user entered a URL for a different platform; URL missing the required /in/, /pub/, /company/, or /school/ segment; regional LinkedIn URL with an unexpected subdomain.","solutions":["Use a profile URL with one of the recognised prefixes: https://www.linkedin.com/in/yourUsername, /pub/name/..., /company/name, or /school/name.","Confirm the domain is linkedin.com (regional subdomains like uk.linkedin.com are accepted).","Ensure the path segment after the prefix isn't empty — 'https://www.linkedin.com/in/' alone throws invalidUrl.","For non-throwing checks, use linkedinUrlToHandle(url) which returns null on invalid input."],"exampleFix":"// before — throws on non-profile LinkedIn URL\nconst normalized = validateLinkedInUrl(value);\n\n// after — non-throwing pre-check, then validate\nimport {linkedinUrlToHandle, validateLinkedInUrl} from './linkedin';\nconst trimmed = value.trim();\ntry {\n    if (trimmed && trimmed.includes('://') && linkedinUrlToHandle(trimmed) === null) {\n        setFieldError('linkedin', 'Use a profile URL: linkedin.com/in/, /pub/, /company/, or /school/');\n    } else {\n        setNormalized(validateLinkedInUrl(trimmed));\n    }\n} catch (e) {\n    setFieldError('linkedin', e instanceof Error ? e.message : 'Invalid LinkedIn URL');\n}","handlingStrategy":"try-catch","validationCode":"// Non-throwing pre-check using the URL→handle extractor\nimport {linkedinUrlToHandle} from './linkedin';\nfunction looksLikeLinkedInUrl(input: string): boolean {\n    if (!input || !input.includes('://')) return true;\n    return linkedinUrlToHandle(input) !== null;\n}","typeGuard":"null","tryCatchPattern":"try {\n    const normalized = validateLinkedInUrl(value.trim());\n} catch (e) {\n    setFieldError('linkedin', e instanceof Error ? e.message : 'Invalid LinkedIn URL');\n}","preventionTips":["Use a profile URL with /in/, /pub/, /company/, or /school/ on linkedin.com.","Ensure the path segment after the prefix isn't empty.","Use linkedinUrlToHandle for non-throwing URL checks.","Regional subdomains (uk.linkedin.com) are accepted; other malformed hosts are not."],"tags":["linkedin","social-urls","validation"],"backgroundTag":null,"analyzedSha":"47d8b0e2ad2fd4757d3bc45f46c3ac165ff8a1fe","analyzedAt":"2026-08-13T01:25:26.651Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}