Lunr hugo

I am not a programmer so, please help me here. I am trying to implement Lunr .js and static web site search with https://www.mattwalters.net/posts/hugo-and-lunr tutorial.

  • When I search for something and if that search-string is present in the [index.json] and here is the search js file. I get the first record of the JSON file but not the real article/post. If the search string is not found the search is working properly saying not found .
  • There is no error on the console when I see in the browser. That is where my knowledge of coding goes. Any help will be great.
1 Like

You can have a look at the docdock theme. They use lunrjs and it works very well.

Github : https://github.com/vjeantet/hugo-theme-docdock

Especially the partial body-beforecontent.html

1 Like

Thanks! the theme docdock looks like not updated in a while. Will see if I can change the old function call and make the theme work.

hugo server -D
Building sites … WARN 2020/03/23 17:56:08 .File.BaseFileName on zero object. Wrap it in if or with: {{ with .File }}{{ .BaseFileName }}{{ end }}
ERROR 2020/03/23 17:56:20 render of “taxonomyTerm” failed: execute of template failed: template: _default/list.html:8:3: executing “main” at <partial “pagination.html” $paginator>: error calling partial: “C:\0.Santanu Misra\0.DevOps\2.GIT-HUB\blog\themes\docdock\layouts\partials\pagination.html:7:42”: execute of template failed: template: partials/pagination.html:7:42: executing “partials/pagination.html” at <.Next.RelPermalink>: can’t evaluate field RelPermalink in type *page.Pager
ERROR 2020/03/23 17:56:20 render of “taxonomy” failed: execute of template failed: template: _default/list.html:8:3: executing “main” at <partial “pagination.html” $paginator>: error calling partial: “C:\0.Santanu Misra\0.DevOps\2.GIT-HUB\blog\themes\docdock\layouts\partials\pagination.html:7:42”: execute of template failed: template: partials/pagination.html:7:42: executing “partials/pagination.html” at <.Next.RelPermalink>: can’t evaluate field RelPermalink in type *page.Pager
ERROR 2020/03/23 17:56:20 render of “taxonomyTerm” failed: execute of template failed: template: _default/list.html:8:3: executing “main” at <partial “pagination.html” $paginator>: error calling partial: “C:\0.Santanu Misra\0.DevOps\2.GIT-HUB\blog\themes\docdock\layouts\partials\pagination.html:3:42”: execute of template failed: template: partials/pagination.html:3:42: executing “partials/pagination.html” at <.Prev.RelPermalink>: can’t evaluate field RelPermalink in type *page.Pager
ERROR 2020/03/23 17:56:20 render of “section” failed: execute of template failed: template: _default/list.html:8:3: executing “main” at <partial “pagination.html” $paginator>: error calling partial: “C:\0.Santanu Misra\0.DevOps\2.GIT-HUB\blog\themes\docdock\layouts\partials\pagination.html:3:42”: execute of template failed: template: partials/pagination.html:3:42: executing “partials/pagination.html” at <.Prev.RelPermalink>: can’t evaluate field RelPermalink in type *page.Pager
Built in 15880 ms
Error: Error building site: failed to render pages: render of “section” failed: execute of template failed: template: _default/list.html:8:3: executing “main” at <partial “pagination.html” $paginator>: error calling partial: “C:\0.Santanu Misra\0.DevOps\2.GIT-HUB\blog\themes\docdock\layouts\partials\pagination.html:7:42”: execute of template failed: template: partials/pagination.html:7:42: executing “partials/pagination.html” at <.Next.RelPermalink>: can’t evaluate field RelPermalink in type *page.Pager

Tried hugo-theme-learn theme and search is working ; will figure out thanks.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.