From a0cc840e8221ba8eb25aaf22c7865d6edcd37277 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Sat, 30 Nov 2024 20:50:31 +0700 Subject: [PATCH] [Add] search --- config.yml | 13 +++++++++++-- content/about.md | 1 - content/pages.md | 3 +-- content/search.md | 5 +++++ layouts/_default/index.json | 6 ++++++ layouts/shortcodes/search.html | 11 +++++++++++ 6 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 content/search.md create mode 100644 layouts/_default/index.json create mode 100644 layouts/shortcodes/search.html diff --git a/config.yml b/config.yml index 1bf77d1..ca09d82 100644 --- a/config.yml +++ b/config.yml @@ -1,4 +1,4 @@ -baseURL: +baseURL: / title: miti99 theme: hugo-coder languageCode: vi @@ -105,10 +105,19 @@ languages: - name: Pages weight: 3 url: pages/ - - name: Tags + - name: Search weight: 4 + url: search/ + - name: Tags + weight: 5 url: tags/ - name: Web CV url: https://tiennm99.github.io/webcv - name: PDF CV url: https://tiennm99.github.io/cv/miti99.pdf + +outputs: + home: + - html + - rss + - json diff --git a/content/about.md b/content/about.md index 8d8983b..6dd003f 100644 --- a/content/about.md +++ b/content/about.md @@ -1,6 +1,5 @@ --- title: "Giới thiệu" -slug: "about" --- Xin chào, mừng bạn đã đến với trang của mình. diff --git a/content/pages.md b/content/pages.md index cb1f362..a011fb4 100644 --- a/content/pages.md +++ b/content/pages.md @@ -1,10 +1,9 @@ --- title: "Pages" -slug: "pages" --- Danh sách những trang mình host trên [GitHub Pages](https://pages.github.com/). Thường khá thú vị :> _(Danh sách này được tạo tự động, thứ tự không quan trọng nhé)_ -{{< github-pages >}} \ No newline at end of file +{{< github-pages >}} diff --git a/content/search.md b/content/search.md new file mode 100644 index 0000000..e095632 --- /dev/null +++ b/content/search.md @@ -0,0 +1,5 @@ +--- +title: Tìm kiếm +--- + +{{< search >}} diff --git a/layouts/_default/index.json b/layouts/_default/index.json new file mode 100644 index 0000000..976212a --- /dev/null +++ b/layouts/_default/index.json @@ -0,0 +1,6 @@ +[ +{{- range $i, $p := .Site.RegularPages -}} +{{- if gt $i 0 -}},{{- end -}} +{{- dict "uri" $p.RelPermalink "title" $p.Title "content" ($p.Plain | htmlUnescape | plainify) | jsonify -}} +{{- end -}} +] diff --git a/layouts/shortcodes/search.html b/layouts/shortcodes/search.html new file mode 100644 index 0000000..dbc8de6 --- /dev/null +++ b/layouts/shortcodes/search.html @@ -0,0 +1,11 @@ + + +
+
+

+
+
+
+ + +