site: Clean up deprecation warning

This commit is contained in:
adnano 2021-09-03 00:45:12 -04:00
parent bfdbace471
commit b0cf8c0713

14
site.go
View file

@ -121,16 +121,9 @@ func LoadSite(config string) (*Site, error) {
} }
} }
// deprecate [feeds] // Print deprecation warning for [feeds]
if len(site.Feeds) > 0 { if len(site.Feeds) > 0 {
log.Println("The [feeds] configuration is deprecated") log.Println("WARNING: The [feeds] configuration is deprecated. Please use [[tasks.feeds]] instead:")
for _, task := range site.Tasks {
if len(task.Feeds) > 0 {
log.Println("and can't be used along [[tasks.feeds]]")
return nil, fmt.Errorf("please remove (or rename) the [feeds] category")
}
}
log.Println("Please replace it with [[tasks.feeds]] in every task needing feeds:")
for permalink, title := range site.Feeds { for permalink, title := range site.Feeds {
dir := strings.Trim(permalink, "/") dir := strings.Trim(permalink, "/")
output := path.Join(dir, "atom.xml") output := path.Join(dir, "atom.xml")
@ -142,7 +135,8 @@ output = %q
`, dir, title, output) `, dir, title, output)
} }
log.Println("You will also need to change .Entries to .Pages in \"atom.xml\"")
fmt.Fprintf(log.Writer(), "# NOTE: You will also need to use .Pages instead of .Entries in your feed templates\n")
} }
return site, nil return site, nil