hswg: deduplicate backlinks

This commit is contained in:
Přemysl Eric Janouch 2020-08-15 07:19:53 +02:00
parent d0ce3e3e66
commit f7f892fb59
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 5 additions and 2 deletions

View File

@ -236,10 +236,13 @@ func main() {
sort.Strings(e.backlinks) sort.Strings(e.backlinks)
backlinks := []string{} backlinks, last := []string{}, ""
for _, name := range e.backlinks { for _, name := range e.backlinks {
if name != last {
backlinks = append(backlinks, makeLink(&entries, name)) backlinks = append(backlinks, makeLink(&entries, name))
} }
last = name
}
if len(backlinks) > 0 { if len(backlinks) > 0 {
_, _ = f.WriteString(fmt.Sprintf("<p id=links>Links here: %s</p>\n", _, _ = f.WriteString(fmt.Sprintf("<p id=links>Links here: %s</p>\n",