Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lunr search can't find index.json when baseURL includes path #156

Closed
flyinggrizzly opened this issue Sep 9, 2018 · 0 comments
Closed

Lunr search can't find index.json when baseURL includes path #156

flyinggrizzly opened this issue Sep 9, 2018 · 0 comments

Comments

@flyinggrizzly
Copy link

flyinggrizzly commented Sep 9, 2018

If a site's config declares the baseURL to be something like http://www.example.com/sub/directory/, the search.html partial doesn't take this into account when defining the var baseurl for Lunr to consume.

<script type="text/javascript">
    {{ if .Site.IsMultiLingual }}
        var baseurl = "{{.Site.LanguagePrefix | relURL }}";
    {{ else }}
        var baseurl = '{{ "" | relURL }}';
    {{ end }}
</script>

In this case (for a single language site), the baseurl var is "/", not "/sub/directory/"

I can fix this for a single language site by replacing var baseurl = '{{ "" | relURL }}'; with var baseurl = '{{ .Site.BaseURL }}';

This leaves two problems that I'm not comfortable enough with Hugo or Go templating to solve:

  1. multilanguage site are still broken
  2. we've lost the benefits of relative URLs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant