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 ####################
baseURL = "https://hugoplate.netlify.app/"
baseURL = "https://hugoplate.netlify.app/site/"
title = "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

View File

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

View File

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