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/i18n/en.toml b/i18n/en.toml index 21d1335..18ddf66 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -106,3 +106,7 @@ other = "More" [view_certificate] other = "View Certificate" + +# ============== Translations for Notes ============== +[notes] +other = "Notes" diff --git a/layouts/_default/list.html b/layouts/_default/list.html index ae014d1..ac93f3c 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -23,7 +23,7 @@ diff --git a/layouts/_default/search.html b/layouts/_default/search.html index 515fed4..056bfae 100644 --- a/layouts/_default/search.html +++ b/layouts/_default/search.html @@ -23,7 +23,7 @@ diff --git a/layouts/_default/single.html b/layouts/_default/single.html index e4f4fbb..2e6b4ee 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -23,7 +23,7 @@ diff --git a/layouts/notes/list.html b/layouts/notes/list.html new file mode 100644 index 0000000..3a6c373 --- /dev/null +++ b/layouts/notes/list.html @@ -0,0 +1,62 @@ +{{ define "header" }} + + + +{{ end }} + +{{ define "navbar" }} + {{ partial "navigators/navbar-2.html" . }} +{{ end }} + +{{ define "sidebar" }} + {{ $blogHome:="#" }} + {{ if site.IsMultiLingual }} + {{ $blogHome = (path.Join (cond ( eq .Language.Lang "en") "" .Language.Lang) .Type) }} + {{ end }} + + +{{ end }} + +{{ define "content" }} +
+
+
+ {{ range .RegularPagesRecursive }} + {{ if .Layout }} + {{ else }} + {{ .Content }} + {{ end }} + {{ end }} +
+
+
+{{ end }} + +{{ define "scripts" }} + + + {{ if .Params.math }} + {{ partial "math.html" . }} + {{ end }} +{{ end }} diff --git a/layouts/notes/single.html b/layouts/notes/single.html new file mode 100644 index 0000000..3a6c373 --- /dev/null +++ b/layouts/notes/single.html @@ -0,0 +1,62 @@ +{{ define "header" }} + + + +{{ end }} + +{{ define "navbar" }} + {{ partial "navigators/navbar-2.html" . }} +{{ end }} + +{{ define "sidebar" }} + {{ $blogHome:="#" }} + {{ if site.IsMultiLingual }} + {{ $blogHome = (path.Join (cond ( eq .Language.Lang "en") "" .Language.Lang) .Type) }} + {{ end }} + + +{{ end }} + +{{ define "content" }} +
+
+
+ {{ range .RegularPagesRecursive }} + {{ if .Layout }} + {{ else }} + {{ .Content }} + {{ end }} + {{ end }} +
+
+
+{{ end }} + +{{ define "scripts" }} + + + {{ if .Params.math }} + {{ partial "math.html" . }} + {{ end }} +{{ end }} diff --git a/layouts/partials/navigators/sidebar.html b/layouts/partials/navigators/sidebar.html index 75d0dcf..cc92c94 100644 --- a/layouts/partials/navigators/sidebar.html +++ b/layouts/partials/navigators/sidebar.html @@ -1,8 +1,8 @@ -{{ range .menus }} +{{ range .menuItems }} {{ $class:= "" }} {{ $icon:= "fa-plus-circle" }} - {{ if or ($.ctx.HasMenuCurrent "sidebar" .) ($.ctx.IsMenuCurrent "sidebar" .)}} + {{ if or ($.ctx.HasMenuCurrent $.menuName .) ($.ctx.IsMenuCurrent $.menuName .)}} {{ $icon = "fa-minus-circle"}} {{ $class = "active" }} {{end}} @@ -12,7 +12,7 @@ {{.Name}} {{ else }} diff --git a/layouts/shortcodes/note.html b/layouts/shortcodes/note.html new file mode 100644 index 0000000..bfc8809 --- /dev/null +++ b/layouts/shortcodes/note.html @@ -0,0 +1,7 @@ +
+
{{.Get "title"}}
+
{{ .Inner | markdownify }}
+ {{ if .Get "footer" }} + + {{end}} +
diff --git a/static/css/layouts/main.css b/static/css/layouts/main.css index e733588..70fe743 100644 --- a/static/css/layouts/main.css +++ b/static/css/layouts/main.css @@ -168,6 +168,16 @@ img.right { font-size: 10pt; } +/* ====== codeblocks ====== */ +pre { + margin: 5px; +} + +pre > code { + padding: 10px !important; +} + + /* --- FOOTER START --- */ .footer { diff --git a/static/css/layouts/note.css b/static/css/layouts/note.css new file mode 100644 index 0000000..c6a59e6 --- /dev/null +++ b/static/css/layouts/note.css @@ -0,0 +1,34 @@ +.wrapper { + display: flex; + padding: 0; + margin: 0; + width: 100%; +} + +.content-section { + flex: 80%; + order: 2; + /* background-color: lightseagreen; */ + padding: 0; + position: relative; + padding-left: 0.5rem; + padding-right: 0.5rem; +} + +.content { + padding: 0; + position: relative; + padding-top: 2rem; + min-height: 130vh; +} + +.note-card-holder { + display: flex; + flex-wrap: wrap; + padding-top: 2rem; +} + +.note-card { + margin: 1rem; + align-self: flex-start; +}