{"record":{"id":"919f3da5aabc9306","repo":"gohugoio/hugo","slug":"abort-jekyll-root-contains-neither-posts-nor-draf","errorCode":null,"errorMessage":"abort: jekyll root contains neither posts nor drafts","messagePattern":"abort: jekyll root contains neither posts nor drafts","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands/import.go","lineNumber":419,"sourceCode":"\tif err != nil {\n\t\treturn newUserError(\"path error:\", args[0])\n\t}\n\n\ttargetDir, err := filepath.Abs(filepath.Clean(args[1]))\n\tif err != nil {\n\t\treturn newUserError(\"path error:\", args[1])\n\t}\n\n\tc.r.Println(\"Import Jekyll from:\", jekyllRoot, \"to:\", targetDir)\n\n\tif strings.HasPrefix(filepath.Dir(targetDir), jekyllRoot) {\n\t\treturn newUserError(\"abort: target path should not be inside the Jekyll root\")\n\t}\n\n\tfs := afero.NewOsFs()\n\tjekyllPostDirs, hasAnyPost := c.getJekyllDirInfo(fs, jekyllRoot)\n\tif !hasAnyPost {\n\t\treturn errors.New(\"abort: jekyll root contains neither posts nor drafts\")\n\t}\n\n\terr = c.createProjectFromJekyll(jekyllRoot, targetDir, jekyllPostDirs)\n\tif err != nil {\n\t\treturn newUserError(err)\n\t}\n\n\tc.r.Println(\"Importing...\")\n\n\tfileCount := 0\n\tcallback := func(ctx context.Context, path string, fi hugofs.FileMetaInfo) error {\n\t\tif fi.IsDir() {\n\t\t\treturn nil\n\t\t}\n\n\t\trelPath, err := filepath.Rel(jekyllRoot, path)\n\t\tif err != nil {\n\t\t\treturn newUserError(\"get rel path error:\", path)","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/commands/import.go#L401-L437","documentation":"importFromJekyll walks the Jekyll root via getJekyllDirInfo to find post directories; if hasAnyPost is false (no post directory contained any posts or drafts), the import aborts because there is nothing to import (import.go:417-420).","triggerScenarios":"`hugo import jekyll <root> <target>` where <root> has no _posts or _drafts containing valid posts, or the post dirs are empty.","commonSituations":"Pointing at a non-Jekyll directory; a Jekyll root whose _posts is empty; posts named in a way the detector does not recognise.","solutions":["Verify the Jekyll root contains _posts (and optionally _drafts) with post files","Point the import at the real Jekyll site root","Ensure post files exist and are readable"],"exampleFix":"# before\nhugo import jekyll ~/empty-dir ./out\n# after (point at the real Jekyll root)\nhugo import jekyll ~/my-jekyll-site ./out","handlingStrategy":"validation","validationCode":"if _, hasAnyPost := getJekyllDirInfo(fs, root); !hasAnyPost {\n    return errors.New(\"no posts/drafts found in Jekyll root\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm _posts is populated before importing","Run the import against the actual Jekyll site root"],"tags":["import","jekyll","filesystem","go","hugo"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}