update breadcrumb, lang-switcher

This commit is contained in:
somrat sorkar 2023-06-04 11:07:38 +06:00
parent 0dec449704
commit fb0fa2d9ef
6 changed files with 41 additions and 28 deletions

BIN
exampleSite/assets/images/banner.png Executable file → Normal file

Binary file not shown.

Before

(image error) Size: 42 KiB

After

(image error) Size: 79 KiB

View File

@ -4,7 +4,7 @@
<section class="section pt-14">
<div class="container">
<div class="row justify-center">
<div class="lg:col-7 mb-16 text-center">
<div class="lg:col-7 mb-8 text-center">
<h1 class="mb-4">
{{ .title | markdownify }}
</h1>
@ -21,7 +21,7 @@
{{ end }}
</div>
<div class="col-12">
{{ partial "image" (dict "Src" .image "Alt" "Banner image" "Loading" "eager" "Class" "mx-auto") }}
{{ partial "image" (dict "Src" .image "Alt" "Banner image" "Loading" "eager" "Class" "mx-auto" "Size" "800x") }}
</div>
</div>
</div>

View File

@ -0,0 +1,26 @@
{{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }}
{{ $lang := .Lang | urlize }}
{{ $.Scratch.Add "path" .Site.BaseURL }}
<ul class="breadcrumb mt-6 inline-flex">
<li class="mx-1 capitalize">
<a class="text-primary dark:text-darkmode-primary" href="/">Home</a>
</li>
{{ range $index, $element := split $url "/" }}
{{ if ne $element $lang }}
{{ $.Scratch.Add "path" $element }}
{{ else }}
{{ $.Scratch.Add "path" (add $element "/") }}
{{ end }}
{{ if and (ne $element "") (ne $element $lang) }}
<li class="text-light dark:text-darkmode-light mx-1 capitalize">
<span class="inlin-block mr-1">/</span>
<a
class="text-primary dark:text-darkmode-primary"
href="{{ $.Scratch.Get `path` }}"
>{{ . }}
</a>
</li>
{{ $.Scratch.Add "path" "/" }}
{{ end }}
{{ end }}
</ul>

View File

@ -1,18 +1,25 @@
<!-- Language List -->
{{ $class := .Class }}
{{ $context := .Context }}
{{ $siteLanguages := site.Home.AllTranslations }}
{{ $pageLang := $context.Lang }}
{{ $pageLink := replace $context.RelPermalink $pageLang "" }}
{{ $pageLink = replace $pageLink "//" "/" }}
{{ if $context.IsTranslated }}
<select class="{{ $class }}" onchange="location = this.value">
{{ $siteLanguages := site.Home.AllTranslations }}
{{ $pageLang := $context.Lang }}
{{ range $siteLanguages }}
{{ if eq (string $pageLang) (string .Language) }}
<option id="{{ .Language }}" value="{{ .RelPermalink }}" selected>
<option
id="{{ .Language }}"
value="{{ replace (add .RelPermalink $pageLink) `//` `/` }}"
selected>
{{ .Language.LanguageName }}
</option>
{{ else }}
<option id="{{ .Language }}" value="{{ .RelPermalink }}">
<option
id="{{ .Language }}"
value="{{ replace (add .RelPermalink $pageLink) `//` `/` }}">
{{ .Language.LanguageName }}
</option>
{{ end }}

View File

@ -3,27 +3,7 @@
<div
class="from-body to-theme-light dark:from-darkmode-body dark:to-darkmode-theme-light rounded-2xl bg-gradient-to-b px-8 py-14">
<h1>{{ .Title | title }}</h1>
{{ $url := replace .Permalink ( printf "%s" .Site.BaseURL) "" }}
{{ $.Scratch.Add "path" .Site.BaseURL }}
<ul class="breadcrumb mt-6 inline-flex">
<li class="mx-1 capitalize">
<a class="text-primary dark:text-darkmode-primary" href="/">Home</a>
</li>
{{ range $index, $element := split $url "/" }}
{{ $.Scratch.Add "path" $element }}
{{ if ne $element "" }}
<li class="text-light dark:text-darkmode-light mx-1 capitalize">
<span class="inlin-block mr-1">/</span>
<a
class="text-primary dark:text-darkmode-primary"
href="{{ $.Scratch.Get `path` }}"
>{{ . }}</a
>
</li>
{{ $.Scratch.Add "path" "/" }}
{{ end }}
{{ end }}
</ul>
{{ partial "components/breadcrumb" . }}
</div>
</div>
</section>

View File

@ -1,7 +1,7 @@
{
"name": "hugoplate",
"description": "hugo tailwindcss boilerplate",
"version": "1.0.5",
"version": "1.1.0",
"license": "MIT",
"author": "zeon.studio",
"scripts": {