Refactor templates and partials

pull/8/head
Alex Shpak 2018-11-25 13:30:25 +01:00
parent 461aafe995
commit 76c251066f
11 changed files with 57 additions and 33 deletions

View File

@ -26,6 +26,10 @@
margin: 0 auto;
}
.hide {
display: none;
}
@mixin fixed {
position: fixed;
top: 0;
@ -34,6 +38,12 @@
overflow-y: auto;
}
.hide {
display: none;
}
@mixin dark-links {
a {
color: $nav-link-color;
}
a.active {
color: $color-link;
}
}

View File

@ -103,13 +103,7 @@ ul.pagination {
@include fixed;
}
a {
color: $nav-link-color;
}
a.active {
color: $color-link;
}
@include dark-links;
}
.book-page {

View File

@ -1,5 +1,5 @@
---
title: Index
title: Introduction
type: docs
---

View File

@ -2,7 +2,9 @@
{{ define "main"}}
<main id="main">
<div>
<h1 id="title"><a href="{{ "/docs" }}">Go Home</a></h1>
<h1 id="title"><a href="{{ "/" }}">Go Home</a></h1>
</div>
</main>
{{ end }}
{{ end }}
{{ define "toc" }} {{ end }}

View File

@ -28,21 +28,14 @@
<div class="book-page">
{{ partial "docs/mobile-header" . }}
<article class="markdown">
{{- .Content -}}
</article>
{{ template "main" . }}
</div>
{{ $showToC := default (default true .Site.Params.BookShowToC) .Params.bookshowtoc }}
{{ if and ($showToC) (.Page.TableOfContents) }}
<aside class="book-toc fixed">
{{ partial "docs/toc" . }}
</aside>
{{ end }}
{{ template "toc" . }}
{{ partial "docs/inject/body" . }}
{{ template "_internal/google_analytics_async.html" . }}
</main>
</body>
</html>
</html>

View File

@ -1 +1,9 @@
{{ define "." }} {{ end }}
{{ define "main" }}
<article class="markdown">
{{- .Content -}}
</article>
{{ end }}
{{ define "toc" }}
{{ partial "docs/toc" . }}
{{ end }}

View File

@ -1 +1,9 @@
{{ define "." }} {{ end }}
{{ define "main" }}
<article class="markdown">
{{- .Content -}}
</article>
{{ end }}
{{ define "toc" }}
{{ partial "docs/toc" . }}
{{ end }}

View File

@ -1 +1,6 @@
{{ .Page.TableOfContents }}
{{ $showToC := default (default true .Site.Params.BookShowToC) .Params.bookshowtoc }}
{{ if and ($showToC) (.Page.TableOfContents) }}
<aside class="book-toc fixed">
{{ .Page.TableOfContents }}
</aside>
{{ end }}

View File

@ -16,4 +16,4 @@
{{ template "_internal/google_analytics_async.html" . }}
</body>
</html>
</html>

View File

@ -5,14 +5,16 @@
<h2>
<a href="{{ .Permalink }}">{{ .Title }}</a>
</h2>
<h5>{{ .Date.Format "January 2, 2006" }}</h5>
<h5>
<strong>{{ .Date.Format "January 2, 2006" }}</strong>
</h5>
<p>
{{ .Summary }}
{{- .Summary -}}
{{ if .Truncated }}
<a href="{{ .Permalink }}">...</a>
<a href="{{ .Permalink }}">...</a>
{{ end }}
</p>
</article>
{{ end }}
{{ template "_internal/pagination.html" . }}
{{ end }}
{{ end }}

View File

@ -1,9 +1,11 @@
{{ define "main" }}
<header>
<h1>{{ .Title }}</h1>
<h5>{{ .Date.Format "January 2, 2006" }}</h5>
<h5>
<strong>{{ .Date.Format "January 2, 2006" }}</strong>
</h5>
</header>
<article class="markdown">
{{- .Content -}}
</article>
{{ end }}
{{ end }}