Skip to content

search-index.json not loaded correctly if baseURL is set #91

@cdmaslo

Description

@cdmaslo

Description

There is an error loading search-index.json file if the baseurl is set to anything else than "/"

Steps to reproduce

Make a new installation and set baseurl to "/something/"

Expected result

search-index.json is loaded

Actual result

search-index.json is not loaded

Environment

Not provided - useless

Bug location

In the file doks-core/assets/js/flexsearch.js is a mistake - baseURL is not used at all.
I have fixed it on my side using fetch('{{ "search-index.json" | absURL }}'), but this will not work for more languages

Original code:

  function buildIndex() {
    document.querySelector('.search-loading').classList.remove('d-none');
    fetch("{{ site.LanguagePrefix }}/search-index.json")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions