aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFélix Sipma <felix.sipma@no-log.org>2018-02-07 16:54:11 +0100
committerFélix Sipma <felix.sipma@no-log.org>2018-02-07 16:54:11 +0100
commit28bb5e6450c6f50cef5d805e77d09691c02d3752 (patch)
tree18e7940440d964b1c1c9b3348fe27891274e3024
parent37c17b9936a0da7acde02d39da76079f221c003b (diff)
put header on homepage only
-rw-r--r--layouts/_default/baseof.html34
-rw-r--r--layouts/index.html15
-rw-r--r--layouts/partials/menu.html16
-rw-r--r--static/css/fournil.css8
4 files changed, 41 insertions, 32 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 5665929..4e88be7 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -10,22 +10,26 @@
</head>
<body>
{{ block "header" . }}
- <div class="header">
- <div class="logo">
- <img class="logo-img" src="{{ .Site.BaseURL }}img/logo_pain_transparent.png" alt="logo">
- <address>
- <span class="title">{{ .Site.Title }}</span>
- {{ range $address := .Site.Params.Address }}
- <span class="address">{{ $address }}</span>
- {{ end }}
- <span class="phone">{{ .Site.Params.Phone }}</span>
- <span class="email">
- <a href="mailto:{{ .Site.Params.Email }}">{{ .Site.Params.Email }}</a>
- </span>
- </address>
+ {{ end }}
+ {{ block "menu" .}}
+ <nav id="fournil-nav" class="navbar navbar-expand-lg navbar-light bg-light sticky-top{{ block "fournil-nav-classes" . }}{{ end }}">
+ <a class="navbar-brand" href={{ .Site.BaseURL }}>
+ <img src="{{ .Site.BaseURL }}/img/logo_pain_transparent.png">
+ </a>
+ <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Afficher/Cacher le menu">
+ <span class="navbar-toggler-icon"></span>
+ </button>
+ <div class="collapse navbar-collapse" id="navbarNavDropdown">
+ <ul class="navbar-nav">
+ {{ $currentPage := . }}
+ {{ range .Site.Menus.main }}
+ <li class="nav-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}">
+ <a class="nav-link" href="{{ .URL }}" title="{{ .Name }}">{{ .Name }}</a>
+ </li>
+ {{ end }}
+ </ul>
</div>
- </div>
- {{ partial "menu.html" . }}
+ </nav>
{{ end }}
<div class="container-fluid">
{{ block "main" . }}
diff --git a/layouts/index.html b/layouts/index.html
index 053e136..819924c 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -3,10 +3,24 @@
{{ end }}
{{ define "footer" }}
+<script>
+ var fournilNav = document.getElementById('fournil-nav');
+
+ window.addEventListener('scroll', function (e) {
+ var nav = document.getElementById('fournil-nav');
+ if (nav.offsetTop > 400) {
+ nav.classList.remove('fournil-nologo-nav');
+ } else {
+ nav.classList.add('fournil-nologo-nav');
+ }
+ });
+</script>
<script src="{{ .Site.BaseURL }}js/leaflet.js"></script>
<script src="{{ .Site.BaseURL }}js/fournil-map.js"></script>
{{ end }}
+{{ define "fournil-nav-classes" }} fournil-nologo-nav{{ end }}
+
{{ define "header" }}
<div class="header">
<div class="logo">
@@ -23,7 +37,6 @@
</address>
</div>
</div>
-{{ partial "menu.html" . }}
{{ end}}
{{ define "main" }}
diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html
deleted file mode 100644
index 0e2f5cc..0000000
--- a/layouts/partials/menu.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<nav class="navbar navbar-expand-lg navbar-light bg-light navbar-sticky">
- <a class="navbar-brand" href={{ .Site.BaseURL }}>{{ .Site.Title }}</a>
- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Afficher/Cacher le menu">
- <span class="navbar-toggler-icon"></span>
- </button>
- <div class="collapse navbar-collapse" id="navbarNavDropdown">
- <ul class="navbar-nav">
- {{ $currentPage := . }}
- {{ range .Site.Menus.main }}
- <li class="nav-item{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}">
- <a class="nav-link" href="{{ .URL }}" title="{{ .Name }}">{{ .Name }}</a>
- </li>
- {{ end }}
- </ul>
- </div>
-</nav>
diff --git a/static/css/fournil.css b/static/css/fournil.css
index d799a82..bc77729 100644
--- a/static/css/fournil.css
+++ b/static/css/fournil.css
@@ -53,3 +53,11 @@ address span {
.fournil-content-img {
width: 500px;
}
+
+.navbar-brand img {
+ width: 150px;
+}
+
+.fournil-nologo-nav .navbar-brand img {
+ display: none;
+}