From 3430643870c7037f42862b53593b0d5b41ab486f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zcan=20O=C4=9Fuz?= Date: Thu, 10 Dec 2020 02:16:31 +0300 Subject: [PATCH] Related articles feature and some improvements --- config.toml | 19 +++++++++++++++++++ i18n/en.toml | 3 +++ i18n/tr.toml | 5 ++++- layouts/_default/baseof.html | 6 ++++-- layouts/_default/single.html | 3 +++ layouts/partials/related.html | 10 ++++++++++ static/css/style.css | 5 +++++ 7 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 layouts/partials/related.html diff --git a/config.toml b/config.toml index f9e7aa2..6b07fbf 100644 --- a/config.toml +++ b/config.toml @@ -155,5 +155,24 @@ ignoreFiles = ["\\.Rmd$", "_files$", "_cache$"] MathJaxCDN = "//cdn.bootcss.com" MathJaxVersion = "2.7.1" +[related] + includeNewer = false + threshold = 80 + toLower = false + + [[related.indices]] + name = "keywords" + weight = 100 + + + [[related.indices]] + name = "categories" + weight = 100 + + [[related.indices]] + name = "date" + weight = 10 + [markup.goldmark.renderer] unsafe= true + diff --git a/i18n/en.toml b/i18n/en.toml index 2d4951d..093fe6d 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -30,3 +30,6 @@ other = "Source code" [gorsel] other = "Photo: " + +[related] +other = "More articles you may like" diff --git a/i18n/tr.toml b/i18n/tr.toml index 9e992ad..25544fb 100644 --- a/i18n/tr.toml +++ b/i18n/tr.toml @@ -29,4 +29,7 @@ other = "Özgür Yazılım Derneği, özgür yazılım hareketini ve tüm insanl other = "Kaynak kodu" [gorsel] -other = "Görsel: " \ No newline at end of file +other = "Görsel: " + +[related] +other = "İlginizi çekebilecek diğer yazılar" diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 42f8573..99d7602 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -2,15 +2,16 @@ - + {{ if .IsPage }} + - + @@ -20,6 +21,7 @@ {{ else }} + diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 36d7eea..233aedf 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -12,6 +12,9 @@ {{ end }} {{ .Content }} + {{ if (or (eq .Section "yazilar") (eq .Section "articles")) }} + {{ partial "related" . }} + {{ end }}