code: func resolveContentPath(sites *hugolib.HugoSites, fs afero.Fs, targetPath string) (string, *hugolib.Site) {
  	targetDir := filepath.Dir(targetPath)
  	first := sites.Sites[0]
  
  	var (
  		s              *hugolib.Site
  		siteContentDir string
  	)
  
  	// Try the filename: my-post.en.md
  	for _, ss := range sites.Sites {
  		if strings.Contains(targetPath, "."+ss.Language().Lang+".") {
  			s = ss
  			break
  		}
  	}
  
  	for _, ss := range sites.Sites {
  		contentDir := ss.PathSpec.ContentDir
  		if !strings.HasSuffix(contentDir, helpers.FilePathSeparator) {
  			contentDir += helpers.FilePathSeparator
  		}
  		if strings.HasPrefix(targetPath, contentDir) {
  			siteContentDir = ss.PathSpec.ContentDir
  			if s == nil {
  				s = ss
  			}
  			break
  		}
  	}
  
  	if s == nil {
  		s = first
  	}
  
  	if targetDir != "" && targetDir != "." {
  		exists, _ := helpers.Exists(targetDir, fs)
  
  		if exists {
  			return targetPath, s
  		}
  	}
  
  	if siteContentDir != "" {
  		pp := filepath.Join(siteContentDir, strings.TrimPrefix(targetPath, siteContentDir))
  		return s.PathSpec.AbsPathify(pp), s
  
  	} else {
  		return s.PathSpec.AbsPathify(filepath.Join(first.PathSpec.ContentDir, targetPath)), s
  	}
  
  }
docs: // Resolve the target content path.