Add hasAlternateDuplicateLinks check to entry

This commit is contained in:
Jason Streifling 2024-10-15 18:46:19 +02:00
parent 6782d0c847
commit 9920e077eb
2 changed files with 4 additions and 1 deletions

View File

@ -104,6 +104,9 @@ func (e *Entry) Check() error {
return fmt.Errorf("link element %v of entry %v: %v", i, e.ID.URI, err) return fmt.Errorf("link element %v of entry %v: %v", i, e.ID.URI, err)
} }
} }
if hasAlternateDuplicateLinks(e.Links) {
return fmt.Errorf("links with with a rel attribute value of \"alternate\" and duplicate type and hreflang attribute values found in entry %v", e.ID.URI)
}
if e.Published != nil { if e.Published != nil {
if err := e.Published.Check(); err != nil { if err := e.Published.Check(); err != nil {

View File

@ -170,7 +170,7 @@ func (f *Feed) Check() error {
} }
} }
if hasAlternateDuplicateLinks(f.Links) { if hasAlternateDuplicateLinks(f.Links) {
return errors.New("links with with a rel attribute value of \"alternate\" and duplicate type and hreflang attribute values found") return fmt.Errorf("links with with a rel attribute value of \"alternate\" and duplicate type and hreflang attribute values found in feed %v", f.ID.URI)
} }
if f.Logo != nil { if f.Logo != nil {