Skip to content

Commit

Permalink
Move index generation to Hugo
Browse files Browse the repository at this point in the history
  • Loading branch information
bartdegoede committed Jul 12, 2019
1 parent 7eccae4 commit 335d19e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 73 deletions.
68 changes: 0 additions & 68 deletions Gruntfile.js

This file was deleted.

4 changes: 4 additions & 0 deletions config.toml
Expand Up @@ -21,6 +21,10 @@ assetDir = "static"
url = "/about/"
identifier = "about"

[outputs]
home = ["HTML", "JSON"]
page = ["HTML"]

[params]
# If false display full article contents in blog index.
# Otherwise show description and 'read on' link to individual blog post page.
Expand Down
3 changes: 0 additions & 3 deletions deploy.sh
Expand Up @@ -5,9 +5,6 @@ echo -e "\033[0;32mDeploying updates to GitHub...\033[0m"
# Build the project.
hugo # if using a theme, replace with `hugo -t <YOURTHEME>`

# build search index
grunt search-index

# Go To Public folder
cd public
# Add changes to git.
Expand Down
13 changes: 13 additions & 0 deletions layouts/index.json
@@ -0,0 +1,13 @@
[{{ range $index, $page := .Site.Pages }}
{{- if eq $page.Type "post" -}}
{{- if $page.Plain -}}
{{- if and $index (gt $index 0) -}},{{- end }}
{
"href": "{{ $page.Permalink }}",
"title": "{{ htmlEscape $page.Title }}",
"categories": [{{ range $tindex, $tag := $page.Params.categories }}{{ if $tindex }}, {{ end }}"{{ $tag| htmlEscape }}"{{ end }}],
"content": {{$page.Plain | jsonify}}
}
{{- end -}}
{{- end -}}
{{- end -}}]
1 change: 0 additions & 1 deletion static/js/search/index.json

This file was deleted.

2 changes: 1 addition & 1 deletion static/js/search/search.js
@@ -1,7 +1,7 @@
var searchIndex, $results, pagesIndex;

function initSearchIndex() {
$.getJSON('/js/search/index.json')
$.getJSON('/index.json')
.done(function(documents) {
pagesIndex = documents;
searchIndex = lunr(function() {
Expand Down

0 comments on commit 335d19e

Please sign in to comment.