From 56cd7f285ac9b28d44292e78c3363e0d81b05aa5 Mon Sep 17 00:00:00 2001 From: unwox Date: Sat, 16 Nov 2024 00:22:01 +0600 Subject: add opengraph tags --- bin/serve.fnl | 33 ++++++++++++++++++++++++++------- static/og:image.png | Bin 0 -> 33950 bytes 2 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 static/og:image.png diff --git a/bin/serve.fnl b/bin/serve.fnl index ad53afc..1fc7bd9 100644 --- a/bin/serve.fnl +++ b/bin/serve.fnl @@ -449,20 +449,39 @@ (table.unpack (map #(item-template $2) (teas-of-the-day 10)))]])]) (fn base-template [form path content aside-content] + (local title (if (str.empty? form.query) + texts.meta-title + (.. form.query " | " texts.meta-title))) + (local canonical-url (str.trim (.. "https://everytea.ru" path) "/")) [:html {:lang "ru-RU"} [:head {} [:meta {:charset "utf-8"}] - [:meta {:name "viewport" :content "width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=5.0"}] + [:meta {:name "viewport" + :content (.. "width=device-width,initial-scale=1," + "minimum-scale=1.0,maximum-scale=5.0")}] + ;; opengraph + [:meta {:property "og:title" :content title}] + [:meta {:property "og:description" :content texts.meta-description}] + [:meta {:property "og:type" :content "website"}] + [:meta {:property "og:url" :content canonical-url}] + [:meta {:property "og:image" + :content "https://everytea.ru/static/og:image.png"}] + [:meta {:property "twitter:image" + :content "https://everytea.ru/static/og:image.png"}] + [:meta {:property "vk:image" + :content "https://everytea.ru/static/og:image.png"}] + [:meta {:property "og:image:width" :content "1200"}] + [:meta {:property "og:image:height" :content "630"}] + [:meta {:property "twitter:card" :content "summary_large_image"}] + [:meta {:property "og:locale" :content "ru_RU"}] + ;; inline styles so the page loads faster [:style {} [:NO-ESCAPE (fs.read-file "static/style.css")]] - [:link {:rel "icon" :href "/static/favicon.png"}] + [:link {:rel "icon" :href "https://everytea.ru/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))] + [:link {:rel "canonical" :href canonical-url}] + [:title {} title] [:meta {:name "description" :content texts.meta-description}]] [:body {} [:div {:class "container"} diff --git a/static/og:image.png b/static/og:image.png new file mode 100644 index 0000000..f1656f0 Binary files /dev/null and b/static/og:image.png differ -- cgit v1.2.3