{"record":{"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/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/commands/import.go#L499-L535","documentation":"parseJekyllFilename expects Jekyll post filenames matching the regex (\\d+-\\d+-\\d+)-(.)+\\..* (DATE-slug.ext). If the regex does not match, it returns 'filename not match' and falls back to the current time as the post date (import.go:513-518).","triggerScenarios":"A post file in _posts whose name does not follow the YYYY-MM-DD-title.ext convention reaches parseJekyllFilename.","commonSituations":"Renamed legacy posts without a date prefix; posts imported from another generator with non-conforming names; non-post files placed in _posts.","solutions":["Rename the post to follow YYYY-MM-DD-title.md","Pre-process non-conforming posts before import","Move files that are not real Jekyll posts out of _posts"],"exampleFix":"# before\n_posts/hello-world.md\n# after\n_posts/2024-01-15-hello-world.md","handlingStrategy":"validation","validationCode":"var jekyllNameRe = regexp.MustCompile(`(\\d+-\\d+-\\d+)-(.+)\\..*`)\nif !jekyllNameRe.MatchString(filename) {\n    /* skip, rename, or use fallback date */\n}","typeGuard":null,"tryCatchPattern":"if _, _, err := parseJekyllFilename(name); err != nil {\n    /* log warning, use fallback date, continue */\n}","preventionTips":["Enforce the Jekyll date-prefixed filename convention in _posts","Filter _posts for non-conforming names before running import"],"tags":["import","jekyll","regex","naming","go","hugo"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}