mirror of
https://github.com/alex-shpak/hugo-book.git
synced 2024-11-22 03:19:25 +00:00
Polish multilang mode, update docs
This commit is contained in:
parent
7b52bf4232
commit
13584878c2
@ -160,14 +160,9 @@ disableKinds = ['taxonomy', 'taxonomyTerm']
|
|||||||
# - In blog posts
|
# - In blog posts
|
||||||
BookDateFormat = 'Jan 2, 2006'
|
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.
|
# Index is built on fly, therefore it might slowdown your website.
|
||||||
BookSearch = true
|
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
|
### 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';
|
'use strict';
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
const indexCfg = {{ with .Site.Params.BookSearchConfig }}
|
const indexCfg = {{ with .Scratch.Get "bookSearchConfig" }}
|
||||||
{{ . }};
|
{{ . }};
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{};
|
{};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'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 }}
|
{{ $searchData := resources.Get "search-data.js" | resources.ExecuteAsTemplate $searchDataFile . | resources.Minify | resources.Fingerprint }}
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
// You can add custom styles here.
|
/* You can add custom styles here. */
|
||||||
|
|
||||||
// @import "plugins/numbered";
|
// @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";
|
// @import "plugins/dark";
|
||||||
|
@ -61,11 +61,7 @@ defaultContentLanguage = 'en'
|
|||||||
# - In blog posts
|
# - In blog posts
|
||||||
BookDateFormat = 'Jan 2, 2006'
|
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.
|
# Index is built on fly, therefore it might slowdown your website.
|
||||||
BookSearch = true
|
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
|
# - In blog posts
|
||||||
BookDateFormat: 'Jan 2, 2006'
|
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.
|
# Index is built on fly, therefore it might slowdown your website.
|
||||||
BookSearch: true
|
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
|
- id: Edit this page
|
||||||
translation: 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
|
- id: Edit this page
|
||||||
translation: Edit this page
|
translation: Edit this page
|
||||||
|
|
||||||
|
- id: bookSearchConfig
|
||||||
|
translation: '{ cache: true }'
|
||||||
|
@ -3,3 +3,6 @@
|
|||||||
|
|
||||||
- id: Edit this page
|
- id: Edit this page
|
||||||
translation: Редактировать эту сраницу
|
translation: Редактировать эту сраницу
|
||||||
|
|
||||||
|
- id: bookSearchConfig
|
||||||
|
translation: '{ split: /[^a-zа-яё0-9\w]/gi }'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{{ if or .GitInfo .Site.Params.BookEditPath }}
|
{{ 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" . }}
|
{{ partial "docs/languages" . }}
|
||||||
{{ with .GitInfo }}
|
{{ with .GitInfo }}
|
||||||
<div>
|
<div>
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<div>
|
<div>
|
||||||
{{ if $.File }}
|
{{ if $.File }}
|
||||||
<a class="flex align-center" href="{{ $.Site.Params.BookRepo }}/{{ . }}/{{ $.File.Path }}" target="_blank" rel="noopener">
|
<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>
|
<span>{{ i18n "Edit this page" }}</span>
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}">
|
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}">
|
||||||
|
|
||||||
{{ if default true .Site.Params.BookSearch }}
|
{{ 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 }}
|
{{- $searchJS := resources.Get "search.js" | resources.ExecuteAsTemplate $searchJSFile . | resources.Minify | resources.Fingerprint }}
|
||||||
<script defer src="{{ $searchJS.RelPermalink }}" integrity="{{ $searchJS.Data.Integrity }}"></script>
|
<script defer src="{{ $searchJS.RelPermalink }}" integrity="{{ $searchJS.Data.Integrity }}"></script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
Loading…
Reference in New Issue
Block a user