Skip to content

Commit 9bc3fb2

Browse files
committed
chore(layout): incorporate upstream changes to overridden blowfish files
1 parent 6f960da commit 9bc3fb2

File tree

5 files changed

+95
-38
lines changed

5 files changed

+95
-38
lines changed

layouts/partials/article-link/card-related.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
{{ end }}
2121
{{ end }}
2222

23+
{{ if .Params.featureAsset }}
24+
{{- $genericImage := .Params.featureAsset -}}
25+
{{- if not $featured }}{{ $featured = resources.Get $genericImage }}{{ end -}}
26+
{{ end }}
27+
2328
{{/* page resources */}}
2429
{{ if not (or $featured $featuredURL) }}
2530
{{ $images := .Resources.ByType "image" }}

layouts/partials/article-link/card.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
{{ end }}
2424
{{ end }}
2525

26+
{{ if .Params.featureAsset }}
27+
{{- $genericImage := .Params.featureAsset -}}
28+
{{- if not $featured }}{{ $featured = resources.Get $genericImage }}{{ end -}}
29+
{{ end }}
30+
2631
{{/* page resources */}}
2732
{{ if not (or $featured $featuredURL) }}
2833
{{ $images := .Resources.ByType "image" }}

layouts/partials/footer.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
{{ partial "icon.html" .Pre }}
2626
</span>
2727
{{ end }}
28-
{{ .Name | markdownify }}
28+
{{ .Name | markdownify | emojify }}
2929
</a>
3030
</li>
3131
{{ end }}
@@ -38,11 +38,11 @@
3838
{{ if .Site.Params.footer.showCopyright | default true }}
3939
<p class="text-sm text-neutral-500 dark:text-neutral-400">
4040
{{- with replace .Site.Params.copyright "{ year }" now.Year }}
41-
{{ . | markdownify }}
41+
{{ . | markdownify | emojify }}
4242
{{- else }}
4343
&copy;
4444
{{ now.Format "2006" }}
45-
{{ .Site.Params.Author.name | markdownify }}
45+
{{ .Site.Params.Author.name | markdownify | emojify }}
4646
{{- end }}
4747
</p>
4848
{{ end }}

layouts/partials/head.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@
171171

172172
{{/* Conditional loaded resources */}}
173173
{{ partial "vendor.html" . }}
174+
{{ partial "vendor_custom.html" . }}
175+
{{ partial "learn_custom.html" . }}
176+
{{ partial "dynamic_md_block.html" . }}
174177

175178
{{/* Icons */}}
176179
{{ if templates.Exists "partials/favicons.html" }}

layouts/partials/header/basic.html

Lines changed: 79 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
{{ if .Site.Params.Logo }}
44
{{ $logo := resources.Get .Site.Params.Logo }}
55
{{ if $logo }}
6+
{{ $scalingFactor := 0.125 }}
67
<div>
78
<a href="{{ "" | relLangURL }}" class="flex">
89
<span class="sr-only">{{ .Site.Title | markdownify }}</span>
@@ -13,10 +14,10 @@
1314
{{ else }}
1415
<img
1516
src="{{ $logo.RelPermalink }}"
16-
width="{{ div $logo.Width 2 }}"
17-
height="{{ div $logo.Height 2 }}"
18-
class="logo max-h-[5rem] max-w-[5rem] object-scale-down object-left nozoom"
19-
alt="">
17+
width="{{ mul $logo.Width $scalingFactor }}"
18+
height="{{ mul $logo.Height $scalingFactor }}"
19+
class="logo max-h-{{ printf "[%grem]" (mul 5 $scalingFactor) }} max-w-{{ printf "[%grem]" (mul 5 $scalingFactor) }} object-scale-down object-left nozoom"
20+
alt="">
2021
{{ end }}
2122
</a>
2223
</div>
@@ -49,7 +50,7 @@
4950
{{ end }}
5051

5152
{{ if .Site.Params.footer.showAppearanceSwitcher | default false }}
52-
<div class="{{ if .Site.Params.footer.showScrollToTop | default true -}}{{- end }} flex items-center">
53+
<div class="{{ if .Site.Params.footer.showScrollToTop | default true -}} ltr:mr-14 rtl:ml-14 {{- end }} cursor-pointer text-sm text-neutral-700 hover:text-primary-600 dark:text-neutral dark:hover:text-primary-400">
5354
<button
5455
id="appearance-switcher"
5556
aria-label="Dark mode switcher"
@@ -69,9 +70,6 @@
6970

7071
{{/* Mobile navigation */}}
7172
{{ define "HeaderMobileToolbar" }}
72-
<div class="flex md:hidden items-center gap-x-5 md:ml-12 h-12">
73-
<span></span>
74-
7573
{{ partial "translations.html" . }}
7674
{{ if .Site.Params.enableA11y | default false }}
7775
{{ template "HeaderA11y" (dict "prefix" "mobile-" "Site" .Site) }}
@@ -101,24 +99,22 @@
10199
</div>
102100
</button>
103101
{{ end }}
104-
</div>
105102
{{ end }}
106103

107104
{{ define "HeaderMobileNavigation" }}
108-
<div class="-my-2 md:hidden">
109105
<div id="menu-button" class="block">
110106
{{ if .Site.Menus.main }}
111107
<div class="cursor-pointer hover:text-primary-600 dark:hover:text-primary-400">
112108
{{ partial "icon.html" "bars" }}
113109
</div>
114110
<div
115111
id="menu-wrapper"
116-
class="fixed inset-0 z-30 invisible w-screen h-screen m-0 overflow-auto transition-opacity opacity-0 cursor-default bg-neutral-100/50 backdrop-blur-sm dark:bg-neutral-900/50 pt-[5px]">
112+
class="fixed inset-0 z-30 invisible w-screen h-screen m-0 overflow-auto transition-opacity opacity-0 cursor-default bg-neutral-100/50 backdrop-blur-sm dark:bg-neutral-900/50">
117113
<ul
118-
class="flex space-y-2 mt-3 flex-col items-end w-full px-6 py-6 mx-auto overflow-visible list-none text-end max-w-7xl">
114+
class="flex space-y-2 mt-3 flex-col items-end w-full px-6 py-6 mx-auto overflow-visible list-none ltr:text-right rtl:text-left max-w-7xl menu-ul">
119115
<li id="menu-close-button">
120116
<span
121-
class="cursor-pointer inline-block align-text-bottom hover:text-primary-600 dark:hover:text-primary-400">
117+
class="cursor-pointer inline-block align-text-bottom hover:text-primary-600 dark:hover:text-primary-400 menu-close">
122118
{{ partial "icon.html" "xmark" }}
123119
</span>
124120
</li>
@@ -131,7 +127,7 @@
131127
{{ if .Site.Menus.subnavigation }}
132128
<hr>
133129
<ul
134-
class="flex mt-4 flex-col items-end w-full px-6 py-6 mx-auto overflow-visible list-none text-end max-w-7xl">
130+
class="flex mt-4 flex-col items-end w-full px-6 py-6 mx-auto overflow-visible list-none ltr:text-right rtl:text-left max-w-7xl">
135131
{{ range .Site.Menus.subnavigation }}
136132
<li class="mb-1">
137133
<a
@@ -142,11 +138,11 @@
142138
class="flex items-center">
143139
{{ if .Pre }}
144140
<span {{ if and .Pre .Name }}class="mr-3"{{ end }}>
145-
{{ partial "icon.html" .Pre }}
141+
{{ partial "icon.html" .Pre }}
146142
</span>
147143
{{ end }}
148-
<p class="text-sm font-sm" title="{{ .Title }}">
149-
{{ .Name | markdownify }}
144+
<p class="text-sm font-sm text-gray-500 hover:text-gray-900" title="{{ .Title }}">
145+
{{ .Name | markdownify | emojify }}
150146
</p>
151147
</a>
152148
</li>
@@ -156,7 +152,6 @@
156152
</div>
157153
{{ end }}
158154
</div>
159-
</div>
160155
{{ end }}
161156

162157
{{ define "HeaderA11y" }}
@@ -200,7 +195,7 @@
200195
<div class="space-y-5">
201196
{{ $toggles := slice }}
202197
{{ $shouldDisableBlur := or site.Params.homepage.layoutBackgroundBlur site.Params.article.layoutBackgroundBlur site.Params.list.layoutBackgroundBlur }}
203-
{{ $shouldDisableBackgroundImage := or
198+
{{ $shouldDisableBackgroundImage := or
204199
(eq site.Params.homepage.layout "background")
205200
(eq site.Params.article.heroStyle "background")
206201
(eq site.Params.list.heroStyle "background")
@@ -252,27 +247,31 @@
252247

253248
{{/* ========== Render HTML ========== */}}
254249
<div
255-
class="main-menu flex items-center justify-between py-6 md:justify-start gap-x-3 pt-[2px] pr-2 md:pr-4 pb-[3px] pl-0">
250+
style="padding-left:0;padding-right:0;padding-top:2px;padding-bottom:3px"
251+
class="main-menu flex flex-wrap items-center justify-between px-4 py-6 sm:px-6 md:justify-start gap-x-3">
256252
{{ template "HeaderLogo" . }}
257-
<div class="flex flex-1 items-center justify-between">
253+
254+
<div class="flex flex-1 items-center justify-between w-full md:w-auto">
258255
<nav class="flex space-x-3">
259256
{{ if not .Site.Params.disableTextInHeader | default true }}
260-
<a href="{{ "" | relLangURL }}" class="text-base font-medium">
261-
{{ .Site.Title | markdownify }}
257+
<a href="{{ "" | relLangURL }}" class="text-base font-medium text-gray-500 hover:text-gray-900">
258+
{{ .Site.Title | markdownify | emojify }}
262259
</a>
263260
{{ end }}
264261
</nav>
265262
{{ template "HeaderDesktopNavigation" . }}
266-
{{ template "HeaderMobileToolbar" . }}
267263
</div>
268-
{{ template "HeaderMobileNavigation" . }}
264+
<div class="w-full flex flex-wrap justify-end items-center gap-x-5 md:hidden mt-2">
265+
{{ template "HeaderMobileToolbar" . }}
266+
{{ template "HeaderMobileNavigation" . }}
267+
</div>
269268
</div>
270269

271270
{{ if .Site.Menus.subnavigation }}
272271
<div
273-
class="main-menu flex pb-3 flex-col items-end justify-between md:justify-start space-x-3 {{ if .Site.Params.Logo }}
274-
-mt-[15px]
275-
{{ end }}">
272+
class="main-menu flex pb-3 flex-col items-end justify-between md:justify-start space-x-3" {{ if .Site.Params.Logo }}
273+
style="margin-top:-15px"
274+
{{ end }}>
276275
<div class="hidden md:flex items-center space-x-5">
277276
{{ range .Site.Menus.subnavigation }}
278277
<a
@@ -286,8 +285,8 @@
286285
{{ partial "icon.html" .Pre }}
287286
</span>
288287
{{ end }}
289-
<p class="text-xs font-light" title="{{ .Title }}">
290-
{{ .Name | markdownify }}
288+
<p class="text-xs font-light text-gray-500 hover:text-gray-900" title="{{ .Title }}">
289+
{{ .Name | markdownify | emojify }}
291290
</p>
292291
</a>
293292
{{ end }}
@@ -298,11 +297,56 @@
298297
{{ if .Site.Params.highlightCurrentMenuArea }}
299298
<script>
300299
(function () {
301-
var $mainmenu = $(".main-menu");
302-
var path = window.location.pathname;
303-
$mainmenu.find('a[href="' + path + '"]').each(function (i, e) {
304-
$(e).children("p").addClass("active");
305-
});
300+
var $mainmenu = $(".main-menu");
301+
var path = window.location.pathname;
302+
$mainmenu.find('a[href="' + path + '"]').each(function (i, e) {
303+
$(e).children("p").addClass("active");
304+
});
305+
// Add the click event of the first level menu to realize the expansion and collapse of the menu
306+
document.querySelectorAll('#menu-wrapper .mt-1').forEach((parent) => {
307+
parent.style.width = '7rem';
308+
parent.style.textAlign = 'left';
309+
if (parent.querySelector('span') !== null) {
310+
parent.addEventListener("click", function (e) {
311+
e.preventDefault();
312+
e.stopPropagation();
313+
const root = document.querySelector('#menu-wrapper');
314+
root.style.display = 'block';
315+
if (this.classList.contains('menu-show')) {
316+
this.classList.remove('menu-show');
317+
} else {
318+
this.classList.add('menu-show');
319+
}
320+
// Find the second-level menu li corresponding to the first-level menu and display or hide it according to the style
321+
var nextLiElements = [];
322+
var nextSibling = this.nextSibling;
323+
while (nextSibling) {
324+
if (nextSibling.nodeType === 1 && nextSibling.classList.contains('mb-2')) {
325+
break;
326+
}
327+
if (nextSibling.nodeType === 1 && nextSibling.tagName.toLowerCase() === 'li') {
328+
nextLiElements.push(nextSibling);
329+
}
330+
nextSibling = nextSibling.nextSibling;
331+
}
332+
333+
nextLiElements.forEach(function(nextLi) {
334+
nextLi.style.display = parent.classList.contains('menu-show') ? 'block' : 'none'
335+
});
336+
})
337+
}
338+
if (parent.querySelector('a')?.querySelector('p.text-sm')) {
339+
parent.style.display = 'none';
340+
}
341+
});
342+
document.querySelectorAll('#menu-wrapper .mb-2').forEach((node) => {
343+
node.style.display = 'none';
344+
});
306345
})();
307346
</script>
308347
{{ end }}
348+
349+
{{ $styles := resources.Get "css/styles.css" }}
350+
{{ if $styles }}
351+
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}">
352+
{{ end }}

0 commit comments

Comments
 (0)