From 3bba78a22c4a3c31a936bbcec954420ce1776776 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 12 Sep 2021 14:03:45 +0200 Subject: Implemented search functionality --- .gitignore | 1 + Makefile | 4 + assets/base.css | 3 + content/search/_index.md | 9 ++ layouts/partials/nav.html | 1 - layouts/search/single.html | 7 ++ search/search.go | 212 +++++++++++++++++++++++++++++++++++++++++++++ search/search.html | 15 ++++ 8 files changed, 251 insertions(+), 1 deletion(-) create mode 100644 content/search/_index.md create mode 100644 layouts/search/single.html create mode 100644 search/search.go create mode 100644 search/search.html diff --git a/.gitignore b/.gitignore index d4fd293..31e89a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .*.swp public/ resources/ +search/index.html search/index.json search/search diff --git a/Makefile b/Makefile index 0465a3e..4aa77b3 100644 --- a/Makefile +++ b/Makefile @@ -5,10 +5,14 @@ DESTDIR=public/ build: ## make build # builds an optimized version of the website in $(DESTDIR) @echo "----- Generating site -----" hugo --gc --minify --cleanDestinationDir -d $(DESTDIR) --cacheDir $(CACHEDIR) + cp public/index.json search/ + cp public/search/index.html search/ + (cd search && CGO_ENABLED=0 go build -ldflags '-s -w -extldflags "-static"' ./search.go) .PHONY: clean clean: ## make clean # removed all $(DESTDIR) contents @echo "----- Cleaning old build -----" + rm -f search/index.html search/index.json search/search cd $(DESTDIR) && rm -rf * .PHONY: serve diff --git a/assets/base.css b/assets/base.css index 0061ecd..c32a062 100644 --- a/assets/base.css +++ b/assets/base.css @@ -43,3 +43,6 @@ h1, h2, h3, h4, h5 { margin-right: auto; } } +.fullwidth { + width: 100%; +} diff --git a/content/search/_index.md b/content/search/_index.md new file mode 100644 index 0000000..98f5b7e --- /dev/null +++ b/content/search/_index.md @@ -0,0 +1,9 @@ +--- +title: "Search" +menu: + main: + weight: 1 +layout: single +--- + +What are you looking for ? diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html index f18fcd3..109f687 100644 --- a/layouts/partials/nav.html +++ b/layouts/partials/nav.html @@ -2,7 +2,6 @@