Skip to content

Commit

Permalink
Add nofollow to generated external links
Browse files Browse the repository at this point in the history
Previously, the attribute was added before the links were fixed,
so the newly-generated external links still didn’t have the attribute.

Related: #192
  • Loading branch information
samihda authored and martinklepsch committed Jan 13, 2019
1 parent 8079925 commit 2503ccc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/cljdoc/util/fixref.clj
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@
(let [doc (Jsoup/parse html-str)
scm-rev (or (:name (:tag scm))
(:commit scm))]
(doseq [ext-link (->> (.select doc "a")
(map #(.attributes %))
(filter #(absolute-uri? (.get % "href")))
(remove #(own-uri? (.get % "href"))))]
(.put ext-link "rel" "nofollow"))

(doseq [broken-link (->> (.select doc "a")
(map #(.attributes %))
(remove #(absolute-uri? (.get % "href")))
Expand All @@ -108,6 +102,13 @@
(scm/owner (:url scm)) "/"
(scm/repo (:url scm)) "/"
scm-rev "/")})))

(doseq [ext-link (->> (.select doc "a")
(map #(.attributes %))
(filter #(absolute-uri? (.get % "href")))
(remove #(own-uri? (.get % "href"))))]
(.put ext-link "rel" "nofollow"))

(.toString doc)))


Expand Down

0 comments on commit 2503ccc

Please sign in to comment.