hugo-theme-zzo/layouts/index.html

100 lines
4.0 KiB
HTML
Raw Normal View History

2019-11-07 18:09:15 +00:00
{{ define "title" }}{{ .Site.Title }}{{ end }}
2019-11-04 13:09:44 +00:00
{{ define "main" }}
2020-01-23 17:46:03 +00:00
<main class="main inner" data-sidebar-position="{{ $.Param "sidebarPosition" }}">
2020-01-31 06:06:30 +00:00
<div class="list__main {{ if $.Param "enableSidebar" }}{{ if eq ($.Param "sidebarPosition") "left" }}mr{{ else }}lm{{ end }}{{ else }}lmr{{ end }}">
<div class="summary__container" data-display="block">
{{ $filteredPages := .Site.RegularPages }}
2020-01-31 06:06:30 +00:00
{{ range $.Param "notAllowedTypesInHome" }}
{{ $filteredPages = (where $filteredPages "Type" "!=" (lower .)) }}
{{ end }}
{{ $paginator := .Paginate $filteredPages }}
{{ range $paginator.Pages }}
{{ .Render "summary" }}
{{ end }}
{{ partial "pagination/pagination" . }}
2019-11-04 13:09:44 +00:00
</div>
{{ partial "search/search-result-desktop" . }}
</div>
{{ if $.Param "enableSidebar" }}
2020-01-31 06:06:30 +00:00
<aside class="list__sidebar {{ if eq ($.Param "sidebarPosition") "left" }}l{{ else }}r{{ end }}" data-dir="{{ $.Param "languagedir" | default "ltr" }}">
{{ partial "sidebar/sidebar-home" . }}
</aside>
{{ end }}
</main>
2019-12-08 14:29:02 +00:00
<script>
2020-01-31 06:06:30 +00:00
{{ $sidebarPosition:= $.Param "sidebarPosition" }}
var sidebarPosition = JSON.parse({{ $sidebarPosition | jsonify }});
2020-01-31 06:06:30 +00:00
{{ $enableSidebar:= $.Param "enableSidebar" }}
2020-01-23 13:00:38 +00:00
var enableSidebar = JSON.parse({{ $enableSidebar | jsonify }});
var listMainElem = document.querySelector('.list__main');
var listSideElem = document.querySelector('.list__sidebar');
var gridSmall = 'l';
var gridBig = 'mr';
var gridFull = 'lmr'
if (sidebarPosition === "right") {
gridSmall = 'r';
gridBig = 'lm'
}
enquire.register("screen and (max-width: 769px)", {
2019-12-08 14:29:02 +00:00
match: function () {
2020-01-23 13:00:38 +00:00
if (enableSidebar) {
listMainElem.classList.remove(gridBig);
listMainElem.classList.add(gridFull);
listSideElem.classList.remove(gridSmall);
listSideElem.classList.add('hide');
} else {
if (listMainElem && !listMainElem.classList.contains(gridFull)) {
listMainElem.classList.remove(gridBig);
listMainElem.classList.add(gridFull);
}
if (listSideElem && !listSideElem.classList.contains('hide')) {
listSideElem.classList.add('hide');
}
}
2019-12-08 14:29:02 +00:00
},
unmatch: function () {
2020-01-23 13:00:38 +00:00
if (enableSidebar) {
listMainElem.classList.remove(gridFull);
listMainElem.classList.add(gridBig);
listSideElem.classList.add(gridSmall);
listSideElem.classList.remove('hide');
} else {
if (listMainElem && !listMainElem.classList.contains(gridFull)) {
listMainElem.classList.remove(gridBig);
listMainElem.classList.add(gridFull);
}
if (listSideElem && !listSideElem.classList.contains('hide')) {
listSideElem.classList.add('hide');
}
}
2020-02-20 14:08:34 +00:00
var navCollapseBtn = document.querySelector('.navbar__burger');
2020-02-20 10:08:38 +00:00
var navCollapse = document.getElementsByClassName('navbarm__collapse')[0];
if (navCollapse) {
navCollapse.setAttribute('data-open', false);
navCollapse.style.maxHeight = 0;
2020-02-20 14:08:34 +00:00
navCollapseBtn.classList.remove('is-active');
}
if (document.getElementsByClassName('navbar__menu')[0]) {
document.getElementsByClassName('navbar__menu')[0].classList.remove('is-active');
}
if (document.getElementsByClassName('mobile-search')[0]) {
document.getElementsByClassName('mobile-search')[0].classList.add('hide');
}
2019-12-08 14:29:02 +00:00
},
setup: function () { },
deferSetup: true,
destroy: function () { },
});
</script>
{{ partial "script/home-script" . }}
{{ end }}