aksakalli / jekyll-doc-theme

Jekyll theme for creating project documentation websites
https://aksakalli.github.io/jekyll-doc-theme/
MIT License
288 stars 261 forks source link

Search on local system #38

Closed TB1234 closed 5 years ago

TB1234 commented 5 years ago

I installed jekyll-doc-theme on my local jekyll system. Generally it works fine instead of the search. I got no error message or something like that.

Are there any dependencies for the search?

TB1234 commented 5 years ago

I found my error!

I do not use the blog. So there are not files in the _posts folder. That creates a misspelled search.json. There will be a "," at the end of the docs. So I changed the file to this...

---
---
[
{% for section in site.data.docs %}
  {% for item in section.docs %}
    {% assign item_url = item | prepend:"/docs/" | append:"/" %}
    {% assign p = site.docs | where:"url", item_url | first %}
    {
      "title": "{{ p.title }}",
      "url": "{{ p.url | relative_url }}"
    }{% unless forloop.last %},{% endunless %}
  {% endfor %}
{% endfor %}
]`

Now, the search is working! :-)