1
0
mirror of https://github.com/danog/gojekyll.git synced 2024-11-30 10:49:00 +01:00

Honor site includes

This commit is contained in:
Oliver Steele 2017-06-13 12:38:06 -04:00
parent 2c24bb5ab3
commit c954878abe

View File

@ -137,14 +137,16 @@ func (s *Site) GetFileURL(path string) (string, bool) {
// Exclude returns true iff a site excludes a file.
func (s *Site) Exclude(path string) bool {
// TODO exclude based on glob, not exact match
inclusionMap := stringArrayToMap(s.config.Include)
exclusionMap := stringArrayToMap(s.config.Exclude)
base := filepath.Base(path)
switch {
case inclusionMap[path]:
return false
case path == ".":
return false
case exclusionMap[path]:
return true
// TODO check Include
case strings.HasPrefix(base, "."), strings.HasPrefix(base, "_"):
return true
default: