{{ define "main" }}
{{ $home := .Site.Home }}

{{ i18n "books" }} - {{ $home.Language.LanguageName }}

{{ $books := slice}} {{ range where .Site.Pages "Section" "books" }} {{ $subDirsNumer := .File.Path | strings.Count "/" }} {{ if eq $subDirsNumer 2 }} {{ $books = $books | append (dict "page" . "path" .File.Path) }} {{ end }} {{ end }}
    {{ range sort $books "path" }} {{ if in .path "_index.adoc" }} {{ $bookPath := replaceRE "/_index.adoc" "" .path }} {{ $bookName := replaceRE "books/" "" $bookPath }}
  • {{ .page.Title }}
  • {{ end }} {{ end }}

{{ i18n "articles" }} - {{ $home.Language.LanguageName }}

{{ $articles := slice}} {{ range where .Site.Pages "Section" "articles" }} {{ $subDirsNumer := .File.Path | strings.Count "/" }} {{ if eq $subDirsNumer 2 }} {{ $articles = $articles | append (dict "page" . "path" .File.Path) }} {{ end }} {{ end }}
    {{ range sort $articles "path" }} {{ if in .path "_index.adoc" }} {{ $articlePath := replaceRE "/_index.adoc" "" .path }} {{ $articleName := replaceRE "articles/" "" $articlePath }}
  • {{ .page.Title }}
  • {{ end }} {{ end }}
{{ end }}