gohugoio/hugo · warning

filename not match

Error message

filename not match

What it means

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).

Solutions

  1. Rename the post to follow YYYY-MM-DD-title.md
  2. Pre-process non-conforming posts before import
  3. Move files that are not real Jekyll posts out of _posts

Example fix

# before
_posts/hello-world.md
# after
_posts/2024-01-15-hello-world.md
Defensive patterns

Strategy: validation

Validate before calling

var jekyllNameRe = regexp.MustCompile(`(\d+-\d+-\d+)-(.+)\..*`)
if !jekyllNameRe.MatchString(filename) {
    /* skip, rename, or use fallback date */
}

Try / catch

if _, _, err := parseJekyllFilename(name); err != nil {
    /* log warning, use fallback date, continue */
}

Prevention

When it happens

Trigger: A post file in _posts whose name does not follow the YYYY-MM-DD-title.ext convention reaches parseJekyllFilename.

Common situations: Renamed legacy posts without a date prefix; posts imported from another generator with non-conforming names; non-post files placed in _posts.

Related errors


AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09). Data as JSON: /api/errors/61611d605717a73e. Report an issue: GitHub.

Appendix: 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 52c9bd7908)