diff --git a/main.go b/main.go index 90f4287..9ad878f 100644 --- a/main.go +++ b/main.go @@ -92,25 +92,18 @@ func index(links []Link) (index Index) { linkMap := make(map[string][]Link) backlinkMap := make(map[string][]Link) for _, l := range links { - bl := Link{ - Source: l.Target, - Target: l.Source, - Text: l.Text, - } - // backlink (only if internal) - if _, ok := backlinkMap[l.Target]; ok { - backlinkMap[l.Target] = append(backlinkMap[l.Target], bl) + backlinkMap[l.Target] = append(backlinkMap[l.Target], l) } else { - backlinkMap[l.Target] = []Link{bl} + backlinkMap[l.Target] = []Link{l} } // regular link - if val, ok := linkMap[l.Source]; ok { - val = append(val, l) + if _, ok := linkMap[l.Source]; ok { + linkMap[l.Source] = append(linkMap[l.Source], l) } else { - linkMap[l.Target] = []Link{l} + linkMap[l.Source] = []Link{l} } } index.Links = linkMap diff --git a/partials/graph_partial.html b/partials/graph_partial.html index c01c891..b107b03 100644 --- a/partials/graph_partial.html +++ b/partials/graph_partial.html @@ -1,7 +1,197 @@ + +
\ No newline at end of file