[Bug] statictoc template not compatible with _enablesearch
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 890
- Avg merge
- 2h 11m
- Merged PRs (30d)
- 10
Description
**Describe the bug**
Using "default" and "statictoc" templates, with [_enablesearch](https://dotnet.github.io/docfx/reference/docfx-json-reference.html#_enablesearch) results in the search box being shown but not showing search results when used.
**To Reproduce**
Steps to reproduce the behavior:
1. Create a site with `docfx init`
2. Replace the templates list in docfx.json with `default` and `statictoc`
3. Add a `GlobalMetadata` section to `build` with `"_enableSearch": "true"`
4. Build the website
5. Open index.html in Chrome
6. Type a term into the search box and press enter to submit
**Expected behavior**
Search results are presented for the term entered
**Actual behaviour**
Nothing happens
**Context (please complete the following information):**
- Browser: Chrome Version 116.0.5845.180 (Official Build) (64-bit)
- Form factor: desktop
- Docfx version: 2.70.0
- Template: default, statictoc
**Additional context**
In the console:
DOMException: Failed to construct 'Worker': Script at 'file:///C:/temp/docfx_project/_site/styles/search-worker.min.js' cannot be accessed from origin 'null'.
at enableSearch (file:///C:/temp/docfx_project/_site/styles/docfx.js:131:20)
at HTMLDocument. (file:///C:/temp/docfx_project/_site/styles/docfx.js:14:3)
at ee (file:///C:/temp/docfx_project/_site/styles/docfx.vendor.min.js:1:31745)
at Ge (file:///C:/temp/docfx_project/_site/styles/docfx.vendor.min.js:1:32074)
enableSearch @ docfx.js:142
(anonymous) @ docfx.js:14
ee @ jquery.js:3830
Ge @ jquery.js:3898
setTimeout (async)
(anonymous) @ jquery.js:3936
h @ jquery.js:3564
fireWith @ jquery.js:3694
fire @ jquery.js:3702
h @ jquery.js:3564
fireWith @ jquery.js:3694
ready @ jquery.js:4174
Xe @ jquery.js:4184
Contributor guide
Assessment
This issue has not been assessed yet.