Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/hossainemruz/toha.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo MARTIN <hugo.martin@epitech.eu>2020-10-03 06:59:28 +0300
committerGitHub <noreply@github.com>2020-10-03 06:59:28 +0300
commit46b21e028c0a183ac1a7db40a9cd6479e7eafc22 (patch)
treef45056c43ef87ec0c706b335ae693e41ef38a96d /layouts/partials/sections/home.html
parent6c2cca012758803802a81d06dccb60c2d2d48b66 (diff)
Translations and i18n (#60)
* Managing i18n * Fix absolute path * Config files * Home link manage langage * Fixing footer i18n * Implemented i18n on newsletter * Implemented two languages in example * Removed old section directory * Using yaml in data to organize home summary * Fully working for old versions without i18n * Integrating language menu CSS * Fix language dropdown CSS * Refactor translation codes * Remove duplicate code * Fix URL issues * Move customMenus and other site related config into data section * Fix error during language toggle * Only show the available translation for the posts * Handle navbar brand URL properly * Fix responsiveness Co-authored-by: Hugo MARTIN <hugo.martin.69@gmail.com> Co-authored-by: hossainemruz <emruz@appscode.com>
Diffstat (limited to 'layouts/partials/sections/home.html')
-rw-r--r--layouts/partials/sections/home.html47
1 files changed, 33 insertions, 14 deletions
diff --git a/layouts/partials/sections/home.html b/layouts/partials/sections/home.html
index 549079d..4766a31 100644
--- a/layouts/partials/sections/home.html
+++ b/layouts/partials/sections/home.html
@@ -1,34 +1,53 @@
-{{ $greeting:="Hi! I am" }}
-{{ if .Site.Params.author.greeting }}
- {{ $greeting = .Site.Params.author.greeting }}
+{{ $author:= .Site.Data.author }}
+{{ if (index .Site.Data .Site.Language.Lang).author }}
+ {{ $author = (index .Site.Data .Site.Language.Lang).author }}
{{ end }}
+
{{ $name:="Jane Doe" }}
-{{ if .Site.Params.author.nickname }}
- {{ $name = .Site.Params.author.nickname }}
-{{ else if .Site.Params.author.name }}
- {{ $name = .Site.Params.author.name }}
+{{ if $author.nickname }}
+ {{ $name = $author.nickname }}
+{{ else if $author.name }}
+ {{ $name = $author.name }}
{{ end }}
+
+{{ $sections:= .Site.Data.sections }}
+{{ if (index .Site.Data .Site.Language.Lang).sections }}
+ {{ $sections = (index .Site.Data .Site.Language.Lang).sections }}
+{{ end }}
+
+{{ $backgroundImage:= "assets/images/default-background.jpg" }}
+{{ if .Site.Params.background }}
+ {{ $backgroundImage = .Site.Params.background }}
+{{ end }}
+
+{{ $authorImage:= "assets/images/default-avatar.png" }}
+{{ if $author.image }}
+ {{ $authorImage = $author.image }}
+{{ end }}
+
<div class="container-fluid home" id="home">
<div
class="background container-fluid"
- style="background-image: url('{{ if .Site.Params.background }}{{ .Site.Params.background }}{{ else }}/assets/images/default-background.jpg{{ end }}');"
+ style="background-image: url('{{ $backgroundImage | absURL }}');"
></div>
<div class="container content text-center">
- <img src="{{ if .Site.Params.author.image }}{{ .Site.Params.author.image }}{{ else }}/assets/images/default-avatar.png{{ end }}"
+ <img src="{{ $authorImage | absURL }}"
class="rounded-circle mx-auto d-block img-fluid"
/>
- <h1 class="greeting"> {{ $greeting }} {{ $name }}</h1>
+ <h1 class="greeting"> {{ $author.greeting }} {{ $name }}</h1>
<div class="typing-carousel">
<span id="ityped" class="ityped"></span>
<span class="ityped-cursor"></span>
</div>
<ul id="typing-carousel-data">
- {{ range .Site.Params.author.summary }}
- <li>{{ . }}</li>
+ {{ if $author.summary }}
+ {{ range $author.summary }}
+ <li>{{ . }}</li>
+ {{ end}}
{{ end }}
</ul>
- {{ if .Site.Data.sections }}
- {{ range first 1 (where (sort .Site.Data.sections "section.weight") ".section.enable" true) }}
+ {{ if $sections }}
+ {{ range first 1 (where (sort $sections "section.weight") ".section.enable" true) }}
<a href="#{{ replace (lower .section.name) " " "-" }}"><i class="arrow bounce fa fa-chevron-down"></i></a>
{{ end }}
{{ end }}