{"id":"61611d605717a73e","repo":"gohugoio/hugo","slug":"filename-not-match","errorCode":null,"errorMessage":"filename not match","messagePattern":"filename not match","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"commands/import.go","lineNumber":517,"sourceCode":"\t\t}\n\n\t\tm, err := metadecoders.Default.UnmarshalToMap(b, candidate.format)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\treturn m\n\t}\n\n\tc.r.Println(\"no config file (_config.yml, _config.yaml, or _config.toml) found: is the specified Jekyll root correct?\")\n\treturn nil\n}\n\nfunc (c *importCommand) parseJekyllFilename(filename string) (time.Time, string, error) {\n\tre := regexp.MustCompile(`(\\d+-\\d+-\\d+)-(.+)\\..*`)\n\tr := re.FindAllStringSubmatch(filename, -1)\n\tif len(r) == 0 {\n\t\treturn htime.Now(), \"\", errors.New(\"filename not match\")\n\t}\n\n\tpostDate, err := time.Parse(\"2006-1-2\", r[0][1])\n\tif err != nil {\n\t\treturn htime.Now(), \"\", err\n\t}\n\n\tpostName := r[0][2]\n\n\treturn postDate, postName, nil\n}\n\nfunc (c *importCommand) replaceHighlightTag(match string) string {\n\tr := regexp.MustCompile(`{%\\s*highlight\\s*(.*?)\\s*%}`)\n\tparts := r.FindStringSubmatch(match)\n\tlastQuote := rune(0)\n\tf := func(c rune) bool {\n\t\tswitch {","sourceCodeStart":499,"sourceCodeEnd":535,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/commands/import.go#L499-L535","documentation":"Returned by `parseJekyllFilename` when a post filename does not match the Jekyll naming regex `(\\d+-\\d+-\\d+)-(.+)\\..*` (YYYY-MM-DD-title.ext). Hugo derives the post date and slug from the filename, so a non-conforming name cannot be converted. Note the caller logs 'Failed to parse filename ... Skipping.' and continues — the file is skipped, not fatal to the import.","triggerScenarios":"A file inside `_posts`/`_drafts` whose name lacks the leading `YYYY-MM-DD-` date prefix or has no extension, e.g. `about.md`, `2015-post.md`, or `README`.","commonSituations":"Stray non-post files (README, templates, includes) placed in `_posts`; draft files named without dates; posts renamed by hand losing the date prefix.","solutions":["Rename the skipped file to the Jekyll convention `YYYY-MM-DD-title.md` and re-run the import.","If the file is not a post (README, snippet), remove it from `_posts`/`_drafts` or ignore the skip message.","For drafts without dates, add a date prefix before importing (Jekyll drafts often omit it, but the importer requires it)."],"exampleFix":"# before\n_posts/my-first-post.md\n# after\n_posts/2015-10-01-my-first-post.md","handlingStrategy":"validation","validationCode":"// Jekyll post filenames must match YYYY-MM-DD-title.ext\nvar jekyllPostRe = regexp.MustCompile(`^\\d{4}-\\d{2}-\\d{2}-.+\\..+$`)\nif !jekyllPostRe.MatchString(filepath.Base(path)) {\n    log.Printf(\"skip %s: not a dated Jekyll post filename\", path)\n}","typeGuard":"func isJekyllPostFilename(name string) bool {\n    return regexp.MustCompile(`^\\d{4}-\\d{2}-\\d{2}-`).MatchString(name)\n}","tryCatchPattern":null,"preventionTips":["Rename posts to the canonical YYYY-MM-DD-slug.md pattern before import","Move undated pages out of _posts into regular content directories","Filter the file list with the same regex the importer uses before handing files over"],"tags":["hugo","jekyll-import","filename","regex"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}