update breadcrumb, lang-switcher
This commit is contained in:
parent
0dec449704
commit
fb0fa2d9ef
BIN
exampleSite/assets/images/banner.png
Executable file → Normal file
BIN
exampleSite/assets/images/banner.png
Executable file → Normal file
Binary file not shown.
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 79 KiB |
@ -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>
|
||||
|
26
layouts/partials/components/breadcrumb.html
Normal file
26
layouts/partials/components/breadcrumb.html
Normal 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>
|
@ -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 }}
|
||||
|
@ -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>
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "hugoplate",
|
||||
"description": "hugo tailwindcss boilerplate",
|
||||
"version": "1.0.5",
|
||||
"version": "1.1.0",
|
||||
"license": "MIT",
|
||||
"author": "zeon.studio",
|
||||
"scripts": {
|
||||
|
Loading…
Reference in New Issue
Block a user