summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/serve.fnl3
-rw-r--r--lib/string.fnl5
2 files changed, 5 insertions, 3 deletions
diff --git a/bin/serve.fnl b/bin/serve.fnl
index 9ebd0e8..4f42cdb 100644
--- a/bin/serve.fnl
+++ b/bin/serve.fnl
@@ -439,7 +439,6 @@
db (.. "spellfix:" form.query)
#(spellfix.guess form.query))
nil))
-
[:html {:lang "ru-RU"}
[:head {}
[:meta {:charset "utf-8"}]
@@ -449,6 +448,8 @@
[:link {:rel "icon" :href "/static/favicon.png"}]
[:link {:rel "preload" :fetchpriority "high" :as "image"
:href "/static/logo-hor.svg" :type "image/svg+xml"}]
+ [:link {:rel "canonical"
+ :href (str.trim (.. "https://everytea.ru" path) "/")}]
[:title {} (if (str.empty? form.query)
texts.meta-title
(.. form.query " | " texts.meta-title))]
diff --git a/lib/string.fnl b/lib/string.fnl
index 3e6134e..c722bd3 100644
--- a/lib/string.fnl
+++ b/lib/string.fnl
@@ -32,8 +32,9 @@
(fn ends-with [str end]
(= (string.sub str (- (# end))) end))
-(fn trim [str]
- (str:match "^%s*(.-)%s*$"))
+(fn trim [str pattern]
+ (local pattern (or pattern "%s"))
+ (str:match (.. "^" pattern "*(.-)" pattern "*$")))
(fn truncate [str len ellipsis]
(if (and (= (type str) "string")