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 }}
{{ $context.Scratch.Add "path" (add $element "/") }}
{{ end }} {{ 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>
{{ if eq $element (path.BaseName $pageLink) }}
<span class="text-primary dark:text-darkmode-primary">
{{ . }}
</span>
{{ else }}
<a <a
class="text-primary dark:text-darkmode-primary" class="text-primary dark:text-darkmode-primary"
href="{{ $context.Scratch.Get `path` }}/"> href="{{ .RelPermalink }}">
{{ . }} {{ .Title }}
</a> </a>
{{ end }} <span class="inlin-block mr-1">/</span>
</li> </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": {