From 25e4e9e3d08fd7b398222fc9a1e171032598ac97 Mon Sep 17 00:00:00 2001 From: Emruz Hossain Date: Sun, 28 Mar 2021 01:52:18 +0600 Subject: Add notes layout (#263) * Add note layout Signed-off-by: hossainemruz * Fix note organization Signed-off-by: hossainemruz * WIP: need help adding above 6 sections doesnt fit navbar * Add note layout Signed-off-by: hossainemruz * Add Translation Signed-off-by: hossainemruz Co-authored-by: HenzelMoras --- content/notes/search.md | 52 +++++++ content/posts/search.md | 2 + i18n/bn.toml | 3 + i18n/cn.toml | 3 + i18n/de.toml | 3 + i18n/en.toml | 3 + i18n/es.toml | 3 + i18n/fr.toml | 3 + i18n/hi.toml | 3 + i18n/id.toml | 3 + i18n/it.toml | 3 + i18n/jp.toml | 3 + i18n/ko.toml | 3 + i18n/ru.toml | 3 + i18n/vn.toml | 3 + layouts/_default/list.html | 12 +- layouts/_default/search.html | 6 +- layouts/_default/single.html | 2 +- layouts/notes/list.html | 60 ++++++++ layouts/notes/single.html | 59 +++++++ layouts/partials/navigators/sidebar.html | 6 +- layouts/partials/note-aggregator.html | 18 +++ layouts/partials/sections/recent-posts.html | 2 +- layouts/shortcodes/note.html | 11 ++ static/css/layouts/list.css | 21 +-- static/css/layouts/main.css | 28 ++++ static/css/layouts/notes.css | 231 ++++++++++++++++++++++++++++ 27 files changed, 519 insertions(+), 30 deletions(-) create mode 100644 content/notes/search.md create mode 100644 layouts/notes/list.html create mode 100644 layouts/notes/single.html create mode 100644 layouts/partials/note-aggregator.html create mode 100644 layouts/shortcodes/note.html create mode 100644 static/css/layouts/notes.css diff --git a/content/notes/search.md b/content/notes/search.md new file mode 100644 index 0000000..0f038c1 --- /dev/null +++ b/content/notes/search.md @@ -0,0 +1,52 @@ +--- +title: "Search Results" +sitemap: + priority : 0.1 +layout: "search" +url: search +--- + + +This file exists solely to respond to /search URL with the related `search` layout template. + +No content shown here is rendered, all content is based in the template layouts/page/search.html + +Setting a very low sitemap priority will tell search engines this is not important content. + +This implementation uses Fusejs, jquery and mark.js + + +## Initial setup + +Search depends on additional output content type of JSON in config.toml +\``` +[outputs] + home = ["HTML", "JSON"] +\``` + +## Searching additional fileds + +To search additional fields defined in front matter, you must add it in 2 places. + +### Edit layouts/_default/index.JSON +This exposes the values in /index.json +i.e. add `category` +\``` +... + "contents":{{ .Content | plainify | jsonify }} + {{ if .Params.tags }}, + "tags":{{ .Params.tags | jsonify }}{{end}}, + "categories" : {{ .Params.categories | jsonify }}, +... +\``` + +### Edit fuse.js options to Search +`static/js/search.js` +\``` +keys: [ + "title", + "contents", + "tags", + "categories" +] +\``` diff --git a/content/posts/search.md b/content/posts/search.md index 0f038c1..4586d1f 100644 --- a/content/posts/search.md +++ b/content/posts/search.md @@ -1,5 +1,7 @@ --- title: "Search Results" +date: 2010-06-08T08:06:25+06:00 +weight: 999999 sitemap: priority : 0.1 layout: "search" diff --git a/i18n/bn.toml b/i18n/bn.toml index f80b4ab..781852c 100644 --- a/i18n/bn.toml +++ b/i18n/bn.toml @@ -103,3 +103,6 @@ other = "আরো" [view_certificate] other = "সার্টিফিকেট দেখুন" + +[notes] +other = "নোট সমূহ" diff --git a/i18n/cn.toml b/i18n/cn.toml index 1b6b4a6..0ac0858 100644 --- a/i18n/cn.toml +++ b/i18n/cn.toml @@ -106,3 +106,6 @@ other = "更多的" [view_certificate] other = "查看证书" + +[notes] +other = "笔记" diff --git a/i18n/de.toml b/i18n/de.toml index 1f66ddd..86c6d54 100644 --- a/i18n/de.toml +++ b/i18n/de.toml @@ -106,3 +106,6 @@ other = "Meer" [view_certificate] other = "Bekijk certificaat" + +[notes] +other = "Opmerkingen" diff --git a/i18n/en.toml b/i18n/en.toml index 21d1335..5b6f88c 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -106,3 +106,6 @@ other = "More" [view_certificate] other = "View Certificate" + +[notes] +other = "Notes" diff --git a/i18n/es.toml b/i18n/es.toml index 0b15ed9..c3ec395 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -106,3 +106,6 @@ other = "Más" [view_certificate] other = "Ver Certificado" + +[notes] +other = "Notas" diff --git a/i18n/fr.toml b/i18n/fr.toml index 5d79a59..7e25ca8 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -106,3 +106,6 @@ other = "Suite" [view_certificate] other = "Afficher le certificat" + +[notes] +other = "Remarques" diff --git a/i18n/hi.toml b/i18n/hi.toml index 150799d..eddf166 100644 --- a/i18n/hi.toml +++ b/i18n/hi.toml @@ -106,3 +106,6 @@ other = "अधिक" [view_certificate] other = "प्रमाणपत्र देखें" + +[notes] +other = "टिप्पणियाँ" diff --git a/i18n/id.toml b/i18n/id.toml index b9c20f7..f884ed2 100644 --- a/i18n/id.toml +++ b/i18n/id.toml @@ -106,3 +106,6 @@ other = "Lebih" [view_certificate] other = "Lihat Sertifikat" + +[notes] +other = "Catatan" diff --git a/i18n/it.toml b/i18n/it.toml index 3fce4de..3c88173 100644 --- a/i18n/it.toml +++ b/i18n/it.toml @@ -106,3 +106,6 @@ other = "Di più" [view_certificate] other = "Féach ar an Teastas" + +[notes] +other = "Appunti" diff --git a/i18n/jp.toml b/i18n/jp.toml index 21b8af1..bcb3fa3 100644 --- a/i18n/jp.toml +++ b/i18n/jp.toml @@ -103,3 +103,6 @@ other = "もっと" [view_certificate] other = "ビューの証明書" + +[notes] +other = "ノート" diff --git a/i18n/ko.toml b/i18n/ko.toml index d1df3e9..54a03d6 100644 --- a/i18n/ko.toml +++ b/i18n/ko.toml @@ -106,3 +106,6 @@ other = "더" [view_certificate] other = "인증서보기" + +[notes] +other = "메모" diff --git a/i18n/ru.toml b/i18n/ru.toml index 7483ee9..d20d489 100644 --- a/i18n/ru.toml +++ b/i18n/ru.toml @@ -106,3 +106,6 @@ other = "Более" [view_certificate] other = "Просмотреть сертификат" + +[notes] +other = "Ноты" diff --git a/i18n/vn.toml b/i18n/vn.toml index f91a712..3fb385c 100644 --- a/i18n/vn.toml +++ b/i18n/vn.toml @@ -106,3 +106,6 @@ other = "Hơn" [view_certificate] other = "Xem chứng chỉ" + +[notes] +other = "Ghi chú" diff --git a/layouts/_default/list.html b/layouts/_default/list.html index ae014d1..dd0f21b 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -8,9 +8,9 @@ {{ end }} {{ define "sidebar" }} - {{ $blogHome:="#" }} + {{ $homePage:="#" }} {{ if site.IsMultiLingual }} - {{ $blogHome = (path.Join (cond ( eq .Language.Lang "en") "" .Language.Lang) .Type) }} + {{ $homePage = (path.Join (cond ( eq .Language.Lang "en") "" .Language.Lang) .Type) }} {{ end }}