mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
i18n: fix search for cyrillic #269
This commit is contained in:
parent
1131c68aae
commit
c7b2eee5a6
2 changed files with 11 additions and 1 deletions
|
@ -4,6 +4,12 @@
|
|||
<span data-search-clear=""><i class="fas fa-times"></i></span>
|
||||
</div>
|
||||
{{- $assetBusting := not .Site.Params.disableAssetsBusting }}
|
||||
<script src="{{"js/lunr.min.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
{{- $pageBaseLang := replaceRE "([a-z]+).*" "${1}" .Page.Lang }}
|
||||
<script>
|
||||
var pageBaseLang="{{ $pageBaseLang }}";
|
||||
</script>
|
||||
<script src="{{"js/auto-complete.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
<script src="{{"js/lunr.min.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
<script src="{{"js/lunr.stemmer.support.min.js" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
<script src="{{ (printf "js/lunr.%s.min.js" $pageBaseLang) | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
<script src="{{ "js/search.js" | relURL }}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}"></script>
|
|
@ -9,6 +9,10 @@ function initLunr() {
|
|||
// Set up lunrjs by declaring the fields we use
|
||||
// Also provide their boost level for the ranking
|
||||
lunrIndex = lunr(function() {
|
||||
if(lunr[pageBaseLang]){
|
||||
this.use(lunr[pageBaseLang]);
|
||||
}
|
||||
|
||||
this.ref('index');
|
||||
this.field('title', {
|
||||
boost: 15
|
||||
|
|
Loading…
Reference in a new issue