OSDN Git Service

[fix] : 右寄せのメニューしかないときに動作するように変更
authorhayao <hayao@fascode.net>
Sun, 24 Oct 2021 14:59:27 +0000 (23:59 +0900)
committerhayao <hayao@fascode.net>
Sun, 24 Oct 2021 14:59:27 +0000 (23:59 +0900)
blog/src/layouts/partials/menu.html

index 9da1e32..9bc06e4 100644 (file)
@@ -1,11 +1,11 @@
-{{- if .Site.Menus.main }}
+{{- if or (.Site.Menus.main) (.Site.Menus.right) }}
 <nav class="menu">
        <button class="menu__btn" aria-haspopup="true" aria-expanded="false" tabindex="0">
                <span class="menu__btn-title" tabindex="-1">{{ T "menu_label" }}</span>
        </button>
        <style>
                @media screen and (min-width: 767px) {
-                       .menu__item:nth-child({{ add (len .Site.Menus.main) 1}}){
+                       .menu__item:nth-child({{- if .Site.Menus.main}}{{ add (len .Site.Menus.main) 1 }}{{else}}1{{end}}){
                                margin-left: auto;
                        }
                }