From 9920e077ebb5f5bc176bc7182b76365670932615 Mon Sep 17 00:00:00 2001 From: Jason Streifling Date: Tue, 15 Oct 2024 18:46:19 +0200 Subject: [PATCH] Add hasAlternateDuplicateLinks check to entry --- entry.go | 3 +++ feed.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/entry.go b/entry.go index 044af1e..0589295 100644 --- a/entry.go +++ b/entry.go @@ -104,6 +104,9 @@ func (e *Entry) Check() error { 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 err := e.Published.Check(); err != nil { diff --git a/feed.go b/feed.go index f5c3f10..0b49775 100644 --- a/feed.go +++ b/feed.go @@ -170,7 +170,7 @@ func (f *Feed) Check() error { } } 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 {