diff options
author | vjeantet <valere.jeantet@gmail.com> | 2020-09-09 01:48:16 +0300 |
---|---|---|
committer | vjeantet <valere.jeantet@gmail.com> | 2020-09-09 01:48:16 +0300 |
commit | 3ab13b59a30618964f5f94fc89df330339f3be0e (patch) | |
tree | 991c675da98d4dbc258b054ac353b07f33c2fa41 /layouts | |
parent | 9d0e2aceb887e8c93c23f7d94f8649d71e4be466 (diff) |
refactor hide option in frontmatter
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/baseof.html | 28 | ||||
-rw-r--r-- | layouts/partials/body-article-content.html | 6 | ||||
-rw-r--r-- | layouts/partials/body-header.html | 2 |
3 files changed, 19 insertions, 17 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 5e437fd..ede8f29 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -20,14 +20,14 @@ class=" {{- with .Params.render}}render_{{.}} {{end -}} - {{if .Params.hide_header}}hideheader {{end -}} - {{if .Params.hide_nav}}hidenav {{end -}} - {{if .Params.hide_breadcrumb}}hidebreadcrumb {{end -}} - {{if .Params.hide_toc}}hidetoc {{end -}} - {{if .Params.hide_footer}}hidefooter {{end -}} - {{if .Params.hide_nextpage}}hidenextpage {{end -}} + {{if (in .Params.hide "header")}}hideheader {{end -}} + {{if (in .Params.hide "nav")}}hidenav {{end -}} + {{if (in .Params.hide "breadcrumb")}}hidebreadcrumb {{end -}} + {{if (in .Params.hide "toc")}}hidetoc {{end -}} + {{if (in .Params.hide "footer")}}hidefooter {{end -}} + {{if (in .Params.hide "nextpage")}}hidenextpage {{end -}} "> -<!-- + <style type="text/css"> #debug{ display: -webkit-box; @@ -50,10 +50,12 @@ overflow: auto; } </style> + <!-- <pre id="debug"> - {{ printf "%#v" $redirectURL }} + {{ printf "%#v" .Params.hide }} + {{ printf "%#v" (in .Params.hide "breadcrumb") }} </pre> - --> + --> {{ if ne $redirectURL ""}} <script type="text/javascript"> @@ -64,14 +66,14 @@ {{- .Content -}} {{ else }} - {{if not .Params.hide_header}} + {{if not (in .Params.hide "header")}} <header style=""> {{ partial "body-header.html" . }} </header> {{end}} <article> - {{if not .Params.hide_nav}} + {{if not (in .Params.hide "nav")}} <aside class="{{.Params.layout }}"> {{ partial "body-sidebar.html" . }} </aside> @@ -83,7 +85,7 @@ </section> <!-- NAVIGATION DROITE TOC --> - {{if not .Params.hide_toc}} + {{if not (in .Params.hide "toc")}} <section class="right-menu {{.Params.layout }}"> {{ block "sidepage" . }} {{ end }} @@ -92,7 +94,7 @@ <!-- FIN NAVIGATION DROITE TOC --> </article> - {{if not .Params.hide_footer}} + {{if not (in .Params.hide "footer")}} <footer> {{ partial "body-footer.html" . }} </footer> diff --git a/layouts/partials/body-article-content.html b/layouts/partials/body-article-content.html index 07b5f99..71cec06 100644 --- a/layouts/partials/body-article-content.html +++ b/layouts/partials/body-article-content.html @@ -1,6 +1,6 @@ <!-- FIL D'ARIANE -->
- {{if not .Params.hide_breadcrumb}}
+ {{if not (in .Params.hide "breadcrumb")}}
<nav id="breadcrumb" aria-label="breadcrumb">
<ol class="breadcrumb">
{{ template "breadcrumbnav" (dict "p1" . "p2" .) }}
@@ -57,7 +57,7 @@ <!-- FIN TITRE -->
<!-- JUMP TO SECTION -->
- {{if not .Params.hide_toc}}
+ {{if not (in .Params.hide "toc")}}
<div class="jump-to-section">
<span onclick="$h = $(this);$h.next('nav').slideToggle(100,function () {$h.children('i').attr('class',function () {return $h.next('nav').is(':visible') ? 'fas fa-chevron-down' : 'fas fa-chevron-right';});});">
{{ T "jump-to-section"}}
@@ -81,7 +81,7 @@ </div>
- {{if not .Params.hide_nextpage}}
+ {{if not (in .Params.hide "nextpage")}}
<div class="chevrons {{.Params.layout}}">
{{ partial "_next-prev-page.html" .CurrentSection }}
</div>
diff --git a/layouts/partials/body-header.html b/layouts/partials/body-header.html index 97893a7..1b32e30 100644 --- a/layouts/partials/body-header.html +++ b/layouts/partials/body-header.html @@ -1,5 +1,5 @@ <div> - {{if not .Params.hide_nav}} + {{if not (in .Params.hide "nav")}} <div class="burger {{.Params.layout }}"> <a href="javascript:void(0);" style="font-size:15px;" onclick="$('article > aside').toggleClass('responsive')">☰</a> </div> |