Skip to content

Commit 335d19e

Browse files
committed
Move index generation to Hugo
1 parent 7eccae4 commit 335d19e

File tree

6 files changed

+18
-73
lines changed

6 files changed

+18
-73
lines changed

Gruntfile.js

Lines changed: 0 additions & 68 deletions
This file was deleted.

config.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ assetDir = "static"
2121
url = "/about/"
2222
identifier = "about"
2323

24+
[outputs]
25+
home = ["HTML", "JSON"]
26+
page = ["HTML"]
27+
2428
[params]
2529
# If false display full article contents in blog index.
2630
# Otherwise show description and 'read on' link to individual blog post page.

deploy.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
55
# Build the project.
66
hugo # if using a theme, replace with `hugo -t <YOURTHEME>`
77

8-
# build search index
9-
grunt search-index
10-
118
# Go To Public folder
129
cd public
1310
# Add changes to git.

layouts/index.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[{{ range $index, $page := .Site.Pages }}
2+
{{- if eq $page.Type "post" -}}
3+
{{- if $page.Plain -}}
4+
{{- if and $index (gt $index 0) -}},{{- end }}
5+
{
6+
"href": "{{ $page.Permalink }}",
7+
"title": "{{ htmlEscape $page.Title }}",
8+
"categories": [{{ range $tindex, $tag := $page.Params.categories }}{{ if $tindex }}, {{ end }}"{{ $tag| htmlEscape }}"{{ end }}],
9+
"content": {{$page.Plain | jsonify}}
10+
}
11+
{{- end -}}
12+
{{- end -}}
13+
{{- end -}}]

static/js/search/index.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

static/js/search/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var searchIndex, $results, pagesIndex;
22

33
function initSearchIndex() {
4-
$.getJSON('/js/search/index.json')
4+
$.getJSON('/index.json')
55
.done(function(documents) {
66
pagesIndex = documents;
77
searchIndex = lunr(function() {

0 commit comments

Comments
 (0)