Enable search across whole site for child theme. #721
johnnymatthews
started this conversation in
Show and tell
Replies: 1 comment
-
This hack will likely become redundant in the next Doks version though. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Have you changed your site content structure so that your markdown no longer lives in the
content/en/docs
folder, and now your search doesn't work? Are you also using the Doks Child Theme? Here's how to get your search working again.From the root of your project, create a new folder called
assets/js
:Copy the
index.js
file from the Doks NPM package into this new folder:Edit this new
index.js
file by replacing line 97{{ $list := (.Site.Pages) -}}
.So this:
Becomes this:
{{ $list := (.Site.Pages) -}}
Edit
layouts/partials/header/header.html
by replacing line 98 or 112 (depending on your Doks version) with{{ if not .IsHome -}}
.So this:
Becomes this:
Edit
layouts/partials/footer/header.html
by replacing lines 77 and 102 with{{ if and (.Site.Params.options.flexSearch) (not .IsHome) -}}
.So for line 77 this:
Becomes this:
And for line 102, this:
Becomes this:
This should make it so that the search bar works across all your pages, not just the ones in the
content/en/docs
folder.Beta Was this translation helpful? Give feedback.
All reactions