update breadcrumb

This commit is contained in:
somrat sorkar 2023-07-06 12:28:18 +06:00
parent dd7c13e06b
commit 50f2f0444f
3 changed files with 20 additions and 30 deletions

View File

@ -1,5 +1,5 @@
######################## default configuration #################### ######################## default configuration ####################
baseURL = "https://hugoplate.netlify.app/" baseURL = "https://hugoplate.netlify.app/site/"
title = "Hugoplate" title = "Hugoplate"
theme = "hugoplate" theme = "hugoplate"
# Default time zone for time stamps; use any valid tz database name: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List # Default time zone for time stamps; use any valid tz database name: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List

View File

@ -1,41 +1,31 @@
{{ $context := .Context }} {{ $context := .Context }}
{{ $class := .Class }} {{ $class := .Class }}
{{ $base := site.BaseURL }} {{ $base := site.BaseURL }}
{{ $pageLink := replace $context.Permalink $base "" }}
{{ $lang := $context.Lang }}
{{ $context.Scratch.Set "path" "/" }}
<ul class="{{ $class }} inline-flex"> <ul class="{{ $class }} inline-flex space-x-1 capitalize">
<li class="mx-1 capitalize"> <li>
<a <a
class="text-primary dark:text-darkmode-primary" class="text-primary dark:text-darkmode-primary"
href="{{ $base | relLangURL }}"> href="{{ $base | relLangURL }}">
{{ i18n "home" | default "Home" }} {{ i18n "home" | default "Home" }}
</a> </a>
</li> </li>
{{ range $index, $element := split $pageLink "/" }} {{ range $i, $e:= $context.Ancestors.Reverse }}
{{ if ne $element $lang }} <li>
{{ $context.Scratch.Add "path" $element }} {{ if ne $i 0 }}
{{ else }} {{ end }}
{{ $context.Scratch.Add "path" (add $element "/") }} <a
{{ end }} class="text-primary dark:text-darkmode-primary"
{{ if and (ne $element "") (ne $element $lang) }} href="{{ .RelPermalink }}">
<li class="text-light dark:text-darkmode-light mx-1 capitalize"> {{ .Title }}
<span class="inlin-block mr-1">/</span> </a>
{{ if eq $element (path.BaseName $pageLink) }} <span class="inlin-block mr-1">/</span>
<span class="text-primary dark:text-darkmode-primary"> </li>
{{ . }}
</span>
{{ else }}
<a
class="text-primary dark:text-darkmode-primary"
href="{{ $context.Scratch.Get `path` }}/">
{{ . }}
</a>
{{ end }}
</li>
{{ $context.Scratch.Add "path" "/" }}
{{ end }}
{{ end }} {{ end }}
<li>
<span class="text-primary dark:text-darkmode-primary">
{{ $context.Title }}
</span>
</li>
</ul> </ul>

View File

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