gohugoio/hugo · warning

filename not match

Error message

filename not match

What it means

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.

Source

Thrown at commands/import.go:517

		}

		m, err := metadecoders.Default.UnmarshalToMap(b, candidate.format)
		if err != nil {
			continue
		}

		return m
	}

	c.r.Println("no config file (_config.yml, _config.yaml, or _config.toml) found: is the specified Jekyll root correct?")
	return nil
}

func (c *importCommand) parseJekyllFilename(filename string) (time.Time, string, error) {
	re := regexp.MustCompile(`(\d+-\d+-\d+)-(.+)\..*`)
	r := re.FindAllStringSubmatch(filename, -1)
	if len(r) == 0 {
		return htime.Now(), "", errors.New("filename not match")
	}

	postDate, err := time.Parse("2006-1-2", r[0][1])
	if err != nil {
		return htime.Now(), "", err
	}

	postName := r[0][2]

	return postDate, postName, nil
}

func (c *importCommand) replaceHighlightTag(match string) string {
	r := regexp.MustCompile(`{%\s*highlight\s*(.*?)\s*%}`)
	parts := r.FindStringSubmatch(match)
	lastQuote := rune(0)
	f := func(c rune) bool {
		switch {

View on GitHub ↗ (pinned to 8a468df065)

Solutions

  1. Rename the skipped file to the Jekyll convention `YYYY-MM-DD-title.md` and re-run the import.
  2. If the file is not a post (README, snippet), remove it from `_posts`/`_drafts` or ignore the skip message.
  3. For drafts without dates, add a date prefix before importing (Jekyll drafts often omit it, but the importer requires it).

Example fix

# before
_posts/my-first-post.md
# after
_posts/2015-10-01-my-first-post.md
Defensive patterns

Strategy: validation

Validate before calling

// Jekyll post filenames must match YYYY-MM-DD-title.ext
var jekyllPostRe = regexp.MustCompile(`^\d{4}-\d{2}-\d{2}-.+\..+$`)
if !jekyllPostRe.MatchString(filepath.Base(path)) {
    log.Printf("skip %s: not a dated Jekyll post filename", path)
}

Type guard

func isJekyllPostFilename(name string) bool {
    return regexp.MustCompile(`^\d{4}-\d{2}-\d{2}-`).MatchString(name)
}

Prevention

When it happens

Trigger: 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`.

Common situations: Stray non-post files (README, templates, includes) placed in `_posts`; draft files named without dates; posts renamed by hand losing the date prefix.

Related errors


AI-assisted analysis of gohugoio/hugo@8a468df065 (2026-07-31). Data as JSON: /data/errors/61611d605717a73e.json. Report an issue: GitHub ↗.