about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMorgan Astra <m@morganastra.me>2017-03-08 12:30:45 -0800
committerMorgan Astra <m@morganastra.me>2017-03-08 12:30:45 -0800
commitb16cf5d7c9f9f7ebfc7655da10355094eb58c660 (patch)
tree82b4c1835b07275c1f339c950e80f74b55a57178
parent3dce2d2daee7b748b37645678428ecb95c6af37a (diff)
put pronoun examples in meta description for #56
-rw-r--r--src/pronouns/pages.clj6
-rw-r--r--src/pronouns/util.clj4
2 files changed, 8 insertions, 2 deletions
diff --git a/src/pronouns/pages.clj b/src/pronouns/pages.clj
index a9301e3..4940207 100644
--- a/src/pronouns/pages.clj
+++ b/src/pronouns/pages.clj
@@ -118,16 +118,18 @@
 (defn format-pronoun-examples
   [pronoun-declensions]
   (let [sub-objs (map #(s/join "/" (take 2 %)) pronoun-declensions)
-        title (str "Pronoun Island: " (prose-comma-list sub-objs) " examples")]
+        title (str "Pronoun Island: " (prose-comma-list sub-objs) " examples")
+        examples (map #(apply examples-block %) pronoun-declensions)]
     (html
      [:html
       [:head
        [:title title]
        [:meta {:name "viewport" :content "width=device-width"}]
+       [:meta {:name "description" :content (u/strip-markup examples)}]
        [:link {:rel "stylesheet" :href "/pronouns.css"}]]
       [:body
        (header-block title)
-       (map #(apply examples-block %) pronoun-declensions)
+       examples
        (footer-block)]])))
 
 (defn lookup-pronouns [pronouns-string]
diff --git a/src/pronouns/util.clj b/src/pronouns/util.clj
index a000201..3db3c35 100644
--- a/src/pronouns/util.clj
+++ b/src/pronouns/util.clj
@@ -103,3 +103,7 @@
   <x> is already in a sequence for which vector? is false, this will add
   another layer of nesting."
   (if (vector? x) x [x]))
+
+(defn strip-markup [form]
+  (s/join " " (filter string? (flatten form))))
+