Refactor partials, layout and sass files

This commit is contained in:
Alex Shpak
2018-09-11 16:51:27 +02:00
parent 43974d0908
commit 628a4df0df
18 changed files with 95 additions and 68 deletions
+10 -4
View File
@@ -1,25 +1,31 @@
<!DOCTYPE html>
<html>
<head>
{{ partial "book-html-head" . }}
<title>{{ .Site.Title }}</title>
{{ partial "book/html-head" . }}
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
</head>
<body>
<div class="pure-g">
<div class="pure-u book-nav">
{{ partial "book-nav" . }}
{{ partial "book/nav" . }}
</div>
<div class="pure-u book-content">
<div class="pure-g">
<div class="pure-u book-page markdown">
{{ block "main" . }}{{ end }}
</div>
{{ if and (default true .Site.Params.BookShowTOC) (.Page.TableOfContents) }}
<div class="pure-u book-toc">
{{ partial "book-toc" . }}
{{ partial "book/toc" . }}
</div>
{{ end }}
</div>
</div>
</div>
</body>
</html>
-7
View File
@@ -1,7 +0,0 @@
{{ define "title" }}
{{ .Title }} &ndash; {{ .Site.Title }}
{{ end }}
{{ define "main" }}
<div>{{ .Content }}</div>
{{ end }}
+3 -3
View File
@@ -1,7 +1,7 @@
{{ define "title" }}
{{ .Title }} &ndash; {{ .Site.Title }}
{{- define "title" -}}
{{ .Site.Title }}
{{ end }}
{{ define "main" }}
{{- define "main" -}}
<div>{{ .Content }}</div>
{{ end }}
+5 -1
View File
@@ -1,3 +1,7 @@
{{ define "main" }}
{{- define "title" -}}
{{ .Site.Title }}
{{ end }}
{{- define "main" -}}
<div>{{ .Content }}</div>
{{ end }}
-1
View File
@@ -1 +0,0 @@
{{ .Page.TableOfContents }}
@@ -3,7 +3,7 @@
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,600" rel="stylesheet">
<link href="/css/pure-min.css" rel="stylesheet">
<link href="/css/grids-responsive-min.css" rel="stylesheet">
<!-- <link href="/css/grids-responsive-min.css" rel="stylesheet"> -->
{{ $styles := resources.Get "styles.scss" | resources.ToCSS | resources.Minify | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $styles.Permalink }}">
@@ -12,27 +12,29 @@
{{ end }}
<nav role="navigation" class="pure-menu">
{{ partial "book-brand" . }}
<nav role="navigation">
{{ partial "book/nav-brand" . }}
<ul class="pure-menu-list pure-menu-root">
<ul>
{{ range .Scratch.Get "BookSections" }}
{{ template "book-section" (dict "Section" . "CurrentPage" $.Permalink) }}
{{ end }}
</ul>
{{ partial "book/nav-after" . }}
</nav>
<!-- Single section of menu (recursive) -->
{{ define "book-section" }}
<li class="pure-menu-item">
<li {{ if .Section.Params.booktopsection }}class="book-nav-section"{{ end }}>
{{ template "book-heading" .Section }}
<ul class="pure-menu-list">
<ul>
{{ range .Section.Sections }}
{{ template "book-section" (dict "Section" . "CurrentPage" $.CurrentPage) }}
{{ end }}
{{ range .Section.Pages }}
<li class="pure-menu-item">
<a href="{{ .RelPermalink }}" class="pure-menu-link {{ if eq $.CurrentPage .Permalink }}active{{ end }}">
<li>
<a href="{{ .RelPermalink }}" class="{{ if eq $.CurrentPage .Permalink }}active{{ end }}">
{{ default .Title (.File | humanize | title) }}
</a>
</li>
@@ -49,13 +51,13 @@
{{ $title := default .Title $title }}
{{ if .Content }}
<a href="{{ .RelPermalink }}" class="pure-menu-link {{ if .IsSection }}section{{ end }}">
{{- $title -}}
<a href="{{ .RelPermalink }}">
{{- $title -}}
</a>
{{ else }}
<span class="pure-menu-heading {{ if .IsSection }}section{{ end }}">
<a>
{{- $title -}}
</span>
</a>
{{ end }}
{{ end }}
+5
View File
@@ -0,0 +1,5 @@
<nav role="navigation">
{{ partial "book/nav-brand" . }}
{{ with .Site.GetPage .Site.Params.BookMenuBundle }}{{ .Content }}{{ end }}
{{ partial "book/nav-after" . }}
</nav>
+5
View File
@@ -0,0 +1,5 @@
{{ if .Site.Params.BookMenuBundle }}
{{ partial "book/nav-bundle" . }}
{{ else }}
{{ partial "book/nav-auto" . }}
{{ end }}
+1
View File
@@ -0,0 +1 @@
{{ .Page.TableOfContents }}