🐛 Fix: menu item invalid params draft in submenu

This commit is contained in:
Cell
2022-08-28 20:34:49 +08:00
parent d061469497
commit f37622a155
2 changed files with 45 additions and 40 deletions
+1
View File
@@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file.
- :bug: Fix: attribute `media` not allowed on element meta in `[name=theme-color]`
- :bug: Fix: support smooth migration from LoveIt to FixIt ([#174](https://github.com/hugo-fixit/FixIt/discussions/174) [#182](https://github.com/hugo-fixit/FixIt/issues/182))
- :bug: Fix: `center-quote` shortcode rendering error when config `unsafe = false` (@yureiita[#160](https://github.com/hugo-fixit/FixIt/pull/160))
- :bug: Fix: menu item invalid params `draft` in submenu
- :art: Style: change the default icons of some social links
- :globe_with_meridians: Docs(i18n): update pt-br, de in i18n
- :mag: Perf(SEO): enhance SEO performance
+44 -40
View File
@@ -43,7 +43,7 @@
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
{{- if (ne .Params.Draft true) | or $buildDrafts | and (ne .Params.Type "mobile") -}}
{{- if (ne .Params.Draft true) | or $buildDrafts | and (ne .Params.Type "mobile") -}}
<li class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}{{ with .Params.Class }} {{ . }}{{ end }}{{ if .HasChildren }} has-children{{ end }}">
<a
class="menu-link"
@@ -64,21 +64,23 @@
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
<li
class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}{{ with .Params.Class }} {{ . }}{{ end }}"
>
<a
class="menu-link"
href="{{ $url }}"
{{ with .Title }}title="{{ . }}"{{ end }}
{{ if (urls.Parse $url).Host }}rel="noopener noreferrer" target="_blank"{{ end }}
{{- if (ne .Params.Draft true) | or $buildDrafts | and (ne .Params.Type "mobile") -}}
<li
class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}{{ with .Params.Class }} {{ . }}{{ end }}"
>
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}
{{- with .Params.Icon -}}{{ dict "Class" (printf "%v fa-fw fa-sm" .) | partial "plugin/icon.html" }} {{ end }}
{{- .Name }}
{{- with .Post }} {{ . | safeHTML -}}{{- end -}}
</a>
</li>
<a
class="menu-link"
href="{{ $url }}"
{{ with .Title }}title="{{ . }}"{{ end }}
{{ if (urls.Parse $url).Host }}rel="noopener noreferrer" target="_blank"{{ end }}
>
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}
{{- with .Params.Icon -}}{{ dict "Class" (printf "%v fa-fw fa-sm" .) | partial "plugin/icon.html" }} {{ end }}
{{- .Name }}
{{- with .Post }} {{ . | safeHTML -}}{{- end -}}
</a>
</li>
{{- end -}}
{{- end -}}
</ul>
{{- end -}}
@@ -237,35 +239,37 @@
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
<li
class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}{{ with .Params.Class }} {{ . }}{{ end }}"
>
<a
class="menu-link"
href="{{ $url }}"
{{ with .Title }}title="{{ . }}"{{ end }}
{{ if (urls.Parse $url).Host }}rel="noopener noreferrer" target="_blank"{{ end }}
{{- if (ne .Params.Draft true) | or $buildDrafts | and (ne .Params.Type "desktop") -}}
<li
class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}{{ with .Params.Class }} {{ . }}{{ end }}"
>
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}
{{- with .Params.Icon -}}{{ dict "Class" (printf "%v fa-fw fa-sm" .) | partial "plugin/icon.html" }} {{ end }}
{{- .Name }}
{{- with .Post }} {{ . | safeHTML -}}{{- end -}}
</a>
</li>
<a
class="menu-link"
href="{{ $url }}"
{{ with .Title }}title="{{ . }}"{{ end }}
{{ if (urls.Parse $url).Host }}rel="noopener noreferrer" target="_blank"{{ end }}
>
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}
{{- with .Params.Icon -}}{{ dict "Class" (printf "%v fa-fw fa-sm" .) | partial "plugin/icon.html" }} {{ end }}
{{- .Name }}
{{- with .Post }} {{ . | safeHTML -}}{{- end -}}
</a>
</li>
{{- end -}}
{{- end -}}
</ul>
{{- else -}}
<a
class="menu-link"
href="{{ $url }}"
{{ with .Title }}title="{{ . }}"{{ end }}
{{ if (urls.Parse $url).Host }}rel="noopener noreferrer" target="_blank"{{ end }}
>
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}
{{- with .Params.Icon -}}{{ dict "Class" (printf "%v fa-fw fa-sm" .) | partial "plugin/icon.html" }} {{ end }}
{{- .Name }}
{{- with .Post }} {{ . | safeHTML -}}{{- end -}}
</a>
<a
class="menu-link"
href="{{ $url }}"
{{ with .Title }}title="{{ . }}"{{ end }}
{{ if (urls.Parse $url).Host }}rel="noopener noreferrer" target="_blank"{{ end }}
>
{{- with .Pre -}}{{- . | safeHTML }} {{ end }}
{{- with .Params.Icon -}}{{ dict "Class" (printf "%v fa-fw fa-sm" .) | partial "plugin/icon.html" }} {{ end }}
{{- .Name }}
{{- with .Post }} {{ . | safeHTML -}}{{- end -}}
</a>
{{- end -}}
</li>
{{- end -}}