Polish multilang mode, update docs
This commit is contained in:
parent
7b52bf4232
commit
13584878c2
14 changed files with 32 additions and 27 deletions
|
@ -160,14 +160,9 @@ disableKinds = ['taxonomy', 'taxonomyTerm']
|
|||
# - In blog posts
|
||||
BookDateFormat = 'Jan 2, 2006'
|
||||
|
||||
# (Optional, default true) Enables search function with lunr.js,
|
||||
# (Optional, default true) Enables search function with flexsearch,
|
||||
# Index is built on fly, therefore it might slowdown your website.
|
||||
BookSearch = true
|
||||
|
||||
# (Optional, default none) Search config for flexsearch index.
|
||||
# Read documentation at https://github.com/nextapps-de/flexsearch#usage. By default 'balance' preset is used.
|
||||
# This option allows to set specific configs for languages support. Must be valid JavaScript object.
|
||||
BookSearchConfig = '{ cache: true }'
|
||||
```
|
||||
|
||||
### Page Configuration
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
/* To be overridden by theme user, scss variables are also accessible here */
|
||||
/* You can add custom styles here. */
|
||||
|
||||
// @import "plugins/numbered";
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
/* To be overridden by theme user, e.g. set SASS vars*/
|
||||
/* You can override SASS variables here. */
|
||||
|
||||
// @import "plugins/dark";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
(function() {
|
||||
const indexCfg = {{ with .Site.Params.BookSearchConfig }}
|
||||
const indexCfg = {{ with .Scratch.Get "bookSearchConfig" }}
|
||||
{{ . }};
|
||||
{{ else }}
|
||||
{};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
{{ $searchDataFile := printf "%s.%s" .Language.Lang "search-data.js" }}
|
||||
{{ $searchDataFile := printf "%s.search-data.js" .Language.Lang }}
|
||||
{{ $searchData := resources.Get "search-data.js" | resources.ExecuteAsTemplate $searchDataFile . | resources.Minify | resources.Fingerprint }}
|
||||
|
||||
(function() {
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
// You can add custom styles here.
|
||||
/* You can add custom styles here. */
|
||||
|
||||
// @import "plugins/numbered";
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
/* You can override SASS variables here. Below example of simple dark theme. */
|
||||
/* You can override SASS variables here. */
|
||||
|
||||
// @import "plugins/dark";
|
||||
|
|
|
@ -61,11 +61,7 @@ defaultContentLanguage = 'en'
|
|||
# - In blog posts
|
||||
BookDateFormat = 'Jan 2, 2006'
|
||||
|
||||
# (Optional, default true) Enables search function with lunr.js,
|
||||
# (Optional, default true) Enables search function with flexsearch,
|
||||
# Index is built on fly, therefore it might slowdown your website.
|
||||
BookSearch = true
|
||||
|
||||
# (Optional, default {}) Search config for flexsearch index.
|
||||
# Read documentation at https://github.com/nextapps-de/flexsearch#usage. By default 'balance' preset is used.
|
||||
# This option allows to set specific configs for languages support. Must be valid JavaScript object.
|
||||
BookSearchConfig = '{ cache: true }'
|
||||
|
|
|
@ -59,12 +59,6 @@ params:
|
|||
# - In blog posts
|
||||
BookDateFormat: 'Jan 2, 2006'
|
||||
|
||||
# (Optional, default true) Enables search function with lunr.js,
|
||||
# (Optional, default true) Enables search function with flexsearch,
|
||||
# Index is built on fly, therefore it might slowdown your website.
|
||||
BookSearch: true
|
||||
|
||||
# (Optional, default {}) Search config for flexsearch index.
|
||||
# Read documentation at https://github.com/nextapps-de/flexsearch#usage. By default 'balance' preset is used.
|
||||
# This option allows to set specific configs for languages support. Must be valid JavaScript object.
|
||||
BookSearchConfig: |
|
||||
{ cache: true }
|
||||
|
|
|
@ -3,3 +3,12 @@
|
|||
|
||||
- id: Edit this page
|
||||
translation: Edit this page
|
||||
|
||||
- id: bookSearchConfig
|
||||
translation: |
|
||||
{
|
||||
encode: false,
|
||||
tokenize: function(str) {
|
||||
return str.replace(/[\x00-\x7F]/g, '').split('');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,3 +3,6 @@
|
|||
|
||||
- id: Edit this page
|
||||
translation: Edit this page
|
||||
|
||||
- id: bookSearchConfig
|
||||
translation: '{ cache: true }'
|
||||
|
|
|
@ -3,3 +3,6 @@
|
|||
|
||||
- id: Edit this page
|
||||
translation: Редактировать эту сраницу
|
||||
|
||||
- id: bookSearchConfig
|
||||
translation: '{ split: /[^a-zа-яё0-9\w]/gi }'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{ if or .GitInfo .Site.Params.BookEditPath }}
|
||||
<div class="book-footer {{ if not .GitInfo }}justify-end{{ else }}justify-between{{ end }}">
|
||||
<div class="book-footer justify-between">
|
||||
{{ partial "docs/languages" . }}
|
||||
{{ with .GitInfo }}
|
||||
<div>
|
||||
|
@ -14,7 +14,7 @@
|
|||
<div>
|
||||
{{ if $.File }}
|
||||
<a class="flex align-center" href="{{ $.Site.Params.BookRepo }}/{{ . }}/{{ $.File.Path }}" target="_blank" rel="noopener">
|
||||
<img src="{{ "svg/edit.svg" | relURL }}" alt="Edit" />
|
||||
<img src="{{ "svg/edit.svg" | relURL }}" alt="{{ i18n "Edit this page" }}" />
|
||||
<span>{{ i18n "Edit this page" }}</span>
|
||||
</a>
|
||||
{{ end }}
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}">
|
||||
|
||||
{{ if default true .Site.Params.BookSearch }}
|
||||
{{- $searchJSFile := printf "%s.%s" .Language.Lang "search.js" -}}
|
||||
{{- .Scratch.Set "bookSearchConfig" (i18n "bookSearchConfig") -}}} <!-- Remove after https://github.com/gohugoio/hugo/issues/6331 -->
|
||||
{{- $searchJSFile := printf "%s.search.js" .Language.Lang -}}
|
||||
{{- $searchJS := resources.Get "search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | resources.Fingerprint }}
|
||||
<script defer src="{{ $searchJS.RelPermalink }}" integrity="{{ $searchJS.Data.Integrity }}"></script>
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in a new issue