Closed alex-hedley closed 9 months ago
Sorry for the delay! Finally trying to get caught up on some of these issues. I'm not quite sure I understand the problem here yet - generally setting a deployed path changes links so that they take into account that URLs need a subpath, not where the actual files are output (they'll still go to the output
directory). Is the problem here that the link to the search JavaScript file doesn't contain the correct subpath, and therefore the front-end can't find the search index? Or is it that when you specify an alternate RootPath
that contains your input
, output
, etc. directories locally that the search index doesn't go there like it should?
Sorry, I should have provided a working example.
For instance if I was to deploy via GitHub Pages to the route project like alex-hedley.github.io it would work.
But if I want to do it in another repo like blog it doesn't work. Maybe I'm missing a setting?
My POC is here: statiqweb-example which is deployed at https://alex-hedley.github.io/statiqweb-example/
When I type in a search query and press Enter it goes to https://alex-hedley.github.io/search?query=mermaid
not https://alex-hedley.github.io/statiqweb-example/search?query=mermaid
.
Do I only need to add the following to my appsettings.json?
"GenerateSearchIndex": true,
"LinkRoot": "/statiqweb-example"
I've tried setting SearchIncludeHost
in WebKeys.cs but does that include the LinkRoot
too?
Got it! And I can replicate locally. This is actually a bug in the CleanBlog theme, so I'll move this issue there. The problem is that the theme files aren't accounting for the LinkRoot
setting when linking to the search page or indexes. Your configuration file above should be fine once this bug is fixed (which I'm doing now).
Legend,thank you.
The fix is committed to the theme, but it's a relatively small one so it might just be easier to copy it into your theme copy than check everything out:
Let me know if you have any other issues!
I've got CleanBlog as a submodule so
locally
cd src/theme
cd fetch
CI/CD
steps:
- name: 🚚 Checkout
uses: actions/checkout@v3
with:
submodules: true
Looks like it's still pulling af2f289 instead of ad63989 when checking the â–½ Fetching submodules
in my pipeline https://github.com/alex-hedley/statiqweb-example/actions/runs/7302063613/job/19899968395 but that's more a me problem I'll look into.
Thanks for the quick fix, appreciate it.
Edit
Forgot to do:
git submodule update --remote --recursive --merge
In
appsettings.json
{ "GenerateSearchIndex": true }
doesn't go to deployed path.If you are hosting via GitHub pages but not on the root repo what are the settings needed to make search work?