📝 Updated README due changes in templates lookup
This commit is contained in:
parent
47c88e26f0
commit
0ea82fe25d
|
@ -82,11 +82,10 @@ Any static files can be hosted and published in two ways:
|
|||
* In `$HOME_STATIC_DIR` as publicly available static, "as is" without any restrictions, in the same path in which the file is located in the directory;
|
||||
* In `$HOME_CONTENT_DIR` next to the specific page: the file will be available in the `.Site.Resources` and `.Page.Resources` collections and restricted by the access settings of the parent page;
|
||||
|
||||
Templates are required to render page content in browsers and must be placed in `$HOME_THEME_DIR`. At least one template with a `baseof` block that will be called for each page is required, for example:
|
||||
Templates are required to render page content in browsers and must be placed in `$HOME_THEME_DIR`. At least one template `baseof.html` that will be called for each page is required, for example:
|
||||
```html
|
||||
<!-- theme/baseof.html -->
|
||||
|
||||
{{ define "baseof" }}
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ or .Page.Language.Lang .Site.Language.Lang }}"
|
||||
dir="{{ or .Page.Language.Dir .Site.Language.Dir }}">
|
||||
|
@ -102,7 +101,6 @@ Templates are required to render page content in browsers and must be placed in
|
|||
{{ block "body" . }}{{ .Page.Content | transform.Markdownify }}{{ end }}
|
||||
</body>
|
||||
</html>
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Templating works according to [the instructions of the standard Go templating engine](https://pkg.go.dev/html/template) with minor additions in the form of [additional utilities](../internal/templateutil/templateutil.go). In `$HOME_THEME_DIR`, any combination and hierarchy of templates and their relationships is allowed as long as there is a `baseof` as a single parent block.
|
||||
|
|
|
@ -83,11 +83,10 @@ This is a sample page content for demo.
|
|||
* В `$HOME_STATIC_DIR` как публично доступная статика, без каких-либо ограничений "как есть", по тому же пути в котором файл расположен в директории;
|
||||
* В `$HOME_CONTENT_DIR` рядом с нужной страницей: файл будет доступен в коллекциях `.Site.Resources` и `.Page.Resources` и ограничен настройками доступа родительской страницы;
|
||||
|
||||
Для рендера содержимого страниц в браузерах необходимы шаблоны, которые должны размещаться в `$HOME_THEME_DIR`. Для работы необходим хотя бы один шаблон с блоком `baseof` который будет вызываться для каждой страницы, например:
|
||||
Для рендера содержимого страниц в браузерах необходимы шаблоны, которые должны размещаться в `$HOME_THEME_DIR`. Для работы необходим хотя бы один шаблон `baseof.html` который будет вызываться для каждой страницы, например:
|
||||
```html
|
||||
<!-- theme/baseof.html -->
|
||||
|
||||
{{ define "baseof" }}
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ or .Page.Language.Lang .Site.Language.Lang }}"
|
||||
dir="{{ or .Page.Language.Dir .Site.Language.Dir }}">
|
||||
|
@ -103,7 +102,6 @@ This is a sample page content for demo.
|
|||
{{ block "body" . }}{{ .Page.Content | transform.Markdownify }}{{ end }}
|
||||
</body>
|
||||
</html>
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
Шаблонизация работает по [инструкциям стандартного шаблонизатора Go](https://pkg.go.dev/html/template) с небольшими дополнениями в виде [дополнительных утилит](../internal/templateutil/templateutil.go). В `$HOME_THEME_DIR` разрешена любая комбинация и иеархия шаблонов и их взаимосвязей до тех пор, пока существует `baseof` в качестве единого родительского блока.
|
||||
|
|
Loading…
Reference in New Issue