Skip to content

Instantly share code, notes, and snippets.

@samrat
Created January 26, 2014 09:38
Show Gist options
  • Save samrat/8630590 to your computer and use it in GitHub Desktop.
Save samrat/8630590 to your computer and use it in GitHub Desktop.
;; (def related-posts
;; ^{:doc "Returns n posts related to `post`."}
;; (memoize
;; (fn [in-dir post n]
;; (->> (:tags post)
;; (map #(get (tag-buckets (all-pages in-dir)) %))
;; (apply concat)
;; (map #(dissoc % :file :tags))
;; (remove #{post})
;; (frequencies)
;; (sort-by second)
;; (take n)
;; (map key)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment