Skip to content

Commit 6ef382c

Browse files
committed
refactor: Improve page header and breadcrumb layout
1 parent 6b6c34e commit 6ef382c

File tree

3 files changed

+26
-35
lines changed

3 files changed

+26
-35
lines changed

layouts/partials/components/breadcrumb.html

Lines changed: 22 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,38 @@
22
{{ $class := .Class }}
33
{{ $base := site.BaseURL }}
44

5-
{{/* Visual breadcrumb rendering */}}
65
<nav aria-label="Breadcrumb" class="{{ $class }} md:inline-flex sm:hidden">
7-
<ol class="flex flex-wrap space-x-1 capitalize">
6+
<ol class="flex flex-wrap items-center capitalize text-sm space-x-2">
87
<li>
9-
<div class="flex items-center">
10-
<a class="breadcrumb-link-parent text-primary dark:text-darkmode-primary" href="{{ $base | relLangURL }}">
11-
<span class="breadcrumb-link-text">{{ i18n "home" | default "Home" }}</span>
12-
</a>
13-
<span class="px-1 text-gray-500 dark:text-gray-400" aria-hidden="true">/</span>
14-
</div>
8+
<a href="{{ $base | relLangURL }}" aria-label="Home" title="Home" class="text-gray-600 dark:text-gray-300 flex items-center justify-center w-7 h-7 bg-gray-100 dark:bg-darkmode-theme-dark rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors">
9+
{{ partial "icon.html" (dict "style" "solid" "name" "house" "class" "h-4 w-4") }}
10+
</a>
1511
</li>
1612

13+
{{ $pages := slice }}
1714
{{ if or (eq $context.Section "workshops") (eq $context.Section "contributors") }}
18-
{{ $ncPage := site.GetPage "neuromorphic-computing" }}
19-
<li>
20-
<div class="flex items-center">
21-
<a class="breadcrumb-link-parent text-primary dark:text-darkmode-primary" href="{{ ($ncPage.RelPermalink | default "/neuromorphic-computing/") | relLangURL }}">
22-
<span class="breadcrumb-link-text">{{ $ncPage.Title | default "Neuromorphic Computing" }}</span>
23-
</a>
24-
<span class="px-1 text-gray-500 dark:text-gray-400" aria-hidden="true">/</span>
25-
</div>
26-
</li>
15+
{{ $ncPage := site.GetPage "neuromorphic-computing" }}
16+
{{ $pages = $pages | append (dict "Title" ($ncPage.Title | default "Neuromorphic Computing") "Permalink" (($ncPage.RelPermalink | default "/neuromorphic-computing/") | relLangURL)) }}
2717
{{ end }}
2818

2919
{{ range $context.Ancestors.Reverse }}
30-
{{ if and (not .IsHome) (ne .Title "Pages") (ne .Title "") }}
31-
<li>
32-
<div class="flex items-center">
33-
<a class="breadcrumb-link-parent text-primary dark:text-darkmode-primary" href="{{ .RelPermalink }}">
34-
<span class="breadcrumb-link-text">{{ .Title }}</span>
35-
</a>
36-
<span class="px-1 text-gray-500 dark:text-gray-400" aria-hidden="true">/</span>
37-
</div>
38-
</li>
39-
{{ end }}
20+
{{ if and (not .IsHome) (ne .Title "Pages") (ne .Title "") }}
21+
{{ $pages = $pages | append . }}
22+
{{ end }}
23+
{{ end }}
24+
25+
{{ range $pages }}
26+
<li class="text-gray-400 dark:text-gray-500" aria-hidden="true">/</li>
27+
<li>
28+
<a class="breadcrumb-link-parent text-indigo-600 dark:text-indigo-400" href="{{ .Permalink }}">
29+
<span class="breadcrumb-link-text">{{ .Title }}</span>
30+
</a>
31+
</li>
4032
{{ end }}
4133

42-
<li aria-current="page">
43-
<div class="flex items-center">
44-
<span class="text-text dark:text-darkmode-text">{{ $context.Title }}</span>
45-
</div>
34+
<li class="text-gray-400 dark:text-gray-500" aria-hidden="true">/</li>
35+
<li>
36+
<span class="text-text dark:text-darkmode-text font-semibold">{{ $context.Title }}</span>
4637
</li>
4738
</ol>
4839
</nav>

layouts/partials/components/speaker-details.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="lg:col-3">
22
{{ if .Params.speaker_photo }}
3-
{{ partial "image" (dict "Src" .Params.speaker_photo "Context" .Page "Alt" .Title "Class" "mb-6 rounded" "Size" "300x300" "Command" "Fit")}}
3+
{{ partial "image" (dict "Src" .Params.speaker_photo "Context" .Page "Alt" .Params.speaker_name "Class" "mb-6 rounded" "Size" "300x300" "Command" "Fit")}}
44
{{ end }}
55
</div>
66
{{ if .Params.speaker_bio}}

layouts/partials/page-header.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<section class="from-body to-theme-light dark:from-darkmode-body dark:to-darkmode-theme-light bg-gradient-to-b py-6">
22
<div class="container">
33
<div>
4-
<h1 class="mb-3">{{ .Title | title }}</h1>
5-
<p class="mb-3">{{ .Description }}</p>
6-
<div class="flex flex-wrap items-center justify-between gap-y-2">
4+
<div class="flex flex-wrap items-center justify-between gap-y-2 mb-4">
75
{{ partial "components/breadcrumb" (dict "Context" . ) }}
86
{{ partial "components/edit-page-link.html" . }}
97
</div>
8+
<h1 class="mb-3">{{ .Title | title }}</h1>
9+
<p class="mb-3">{{ .Description }}</p>
1010
</div>
1111
</div>
1212
</section>

0 commit comments

Comments
 (0)