diff options
author | bake <bake@192k.pw> | 2019-05-28 01:00:59 +0300 |
---|---|---|
committer | bake <bake@192k.pw> | 2019-05-28 01:00:59 +0300 |
commit | 3fc2ec5c390a44e06c60e75540c5b4799b3ee1a3 (patch) | |
tree | f81180c5ff5ddbe06a003cd572228224a9c315e7 | |
parent | 80482e9748f8dd521bcdcdf03624885a65872f5b (diff) |
Use baseof instead of header- and footer-partials
-rw-r--r-- | layouts/_default/baseof.html | 45 | ||||
-rw-r--r-- | layouts/_default/list.html | 30 | ||||
-rw-r--r-- | layouts/_default/single.html | 16 | ||||
-rw-r--r-- | layouts/index.html | 1 | ||||
-rw-r--r-- | layouts/partials/footer.html | 19 | ||||
-rw-r--r-- | layouts/partials/header.html | 30 | ||||
-rw-r--r-- | layouts/partials/navigation.html | 12 | ||||
-rw-r--r-- | layouts/partials/pagination.html | 11 |
8 files changed, 80 insertions, 84 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..fa05a2f --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>{{ .Title }}</title> + <meta name="viewport" content="width=device-width"> + {{ with .OutputFormats.Get "RSS" }} + <link href="{{ .RelPermalink }}" rel="alternate" type="application/rss+xml" title="{{ $.Site.Title }}" /> + <link href="{{ .RelPermalink }}" rel="feed" type="application/rss+xml" title="{{ $.Site.Title }}" /> + {{ end }} + <link rel="stylesheet" href="{{ .Site.BaseURL }}css/hybrid.css"> + <link rel="stylesheet" href="{{ .Site.BaseURL }}css/style.css"> + <link rel="stylesheet" href="{{ .Site.BaseURL }}css/colors-{{ .Site.Params.scheme | default "dark" }}.css"> + + {{ partial "head.html" . }} + </head> + <body> + <header id="header"> + <h1><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h1> + <p>{{ .Site.Params.Description }}</p> + </header> + + <div id="page"> + <div id="sidebar"> + {{ partial "navigation.html" . }} + </div> + + <div id="content"> + {{ block "main" . }}{{ end }} + </div> + + <footer id="footer"> + <p class="copyright">Powered by + <a href="https://gohugo.io/">Hugo</a> and the + <a href="https://github.com/bake/solar-theme-hugo">Solar</a>-theme.</p> + </footer> + </div> + + <script src="{{ .Site.BaseURL }}js/highlight.min.js"></script> + <script src="{{ .Site.BaseURL }}js/highlight.go.min.js"></script> + <script> hljs.initHighlightingOnLoad() </script> + + {{ partial "foot.html" . }} + </body> +</html> diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 918297f..d77872e 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,23 +1,15 @@ -{{ range (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections)).Pages }} -<article class="post"> - <h1><a href="{{ .Permalink }}">{{ .Title }}</a> {{ if .Draft }}(Draft){{ end }}</h1> +{{ define "main" }} + {{ range .Paginator.Pages }} + <article class="post"> + <h1><a href="{{ .Permalink }}">{{ .Title }}</a> {{ if .Draft }}(Draft){{ end }}</h1> - <div class="post-content"> - <p>{{ .Summary | plainify | safeHTML }} {{ if .Truncated }} … {{ end }}</p> - </div> + <div class="post-content"> + <p>{{ .Summary | plainify | safeHTML }} {{ if .Truncated }} … {{ end }}</p> + </div> - <p class="meta">Posted on <span class="postdate">{{ .Date.Format "02. January 2006" }}</span></p> -</article> -{{ end }} - -{{ if or .Paginator.HasPrev .Paginator.HasNext }} -<nav class="pagination" role="pagination"> - {{ if (.Paginator.HasPrev) }} - <a class="newer-posts" href="{{ .Paginator.Prev.URL }}"><span aria-hidden="true">←</span> Newer Posts</a> + <p class="meta">Posted on <span class="postdate">{{ .Date.Format "02. January 2006" }}</span></p> + </article> {{ end }} - <span class="page-number">Page {{ .Paginator.PageNumber }} of {{ .Paginator.TotalPages }}</span> - {{ if .Paginator.HasNext }} - <a class="older-posts" href="{{ .Paginator.Next.URL }}">Older Posts <span aria-hidden="true">→</span></a> - {{ end }} -</nav> + + {{ partial "pagination.html" . }} {{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index b7ca924..fc9efa7 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,11 +1,9 @@ -{{ partial "header.html" . }} -<article class="post"> - <h1><a href="{{ .Permalink }}">{{ .Title }}</a> {{ if .Draft }}(Draft){{ end }}</h1> +{{ define "main" }} + <article class="post"> + <h1><a href="{{ .Permalink }}">{{ .Title }}</a> {{ if .Draft }}(Draft){{ end }}</h1> - <div class="post-content"> - {{ .Content | safeHTML }} - </div> + <div class="post-content">{{ .Content | safeHTML }}</div> - <p class="meta">Posted on <span class="postdate">{{ .Date.Format "02. January 2006" }}</span></p> -</article> -{{ partial "footer.html" . }}
\ No newline at end of file + <p class="meta">Posted on <span class="postdate">{{ .Date.Format "02. January 2006" }}</span></p> + </article> +{{ end }} diff --git a/layouts/index.html b/layouts/index.html deleted file mode 100644 index a72d500..0000000 --- a/layouts/index.html +++ /dev/null @@ -1 +0,0 @@ -{{ partial "header.html" . }} {{ template "_default/list.html" . }} {{ partial "footer.html" . }}
\ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html deleted file mode 100644 index 4f25ad3..0000000 --- a/layouts/partials/footer.html +++ /dev/null @@ -1,19 +0,0 @@ -</div> - -<footer id="footer"> - <p class="copyright">Powered by - <a href="https://gohugo.io/">Hugo</a> and the - <a href="https://github.com/bake/solar-theme-hugo">Solar</a>-theme.</p> -</footer> -</div> - -<script src="{{ .Site.BaseURL }}js/highlight.min.js"></script> -<script src="{{ .Site.BaseURL }}js/highlight.go.min.js"></script> -<script> - hljs.initHighlightingOnLoad() -</script> - -{{ partial "foot.html" . }} -</body> - -</html>
\ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html deleted file mode 100644 index 4766d1b..0000000 --- a/layouts/partials/header.html +++ /dev/null @@ -1,30 +0,0 @@ -<!DOCTYPE html> -<html> - -<head> - <meta charset="utf-8"> - <title>{{ .Title }}</title> - <meta name="viewport" content="width=device-width"> - {{ with .OutputFormats.Get "RSS" }} - <link href="{{ .RelPermalink }}" rel="alternate" type="application/rss+xml" title="{{ $.Site.Title }}" /> - <link href="{{ .RelPermalink }}" rel="feed" type="application/rss+xml" title="{{ $.Site.Title }}" /> - {{ end }} - <link rel="stylesheet" href="{{ .Site.BaseURL }}css/hybrid.css"> - <link rel="stylesheet" href="{{ .Site.BaseURL }}css/style.css"> - <link rel="stylesheet" href="{{ .Site.BaseURL }}css/colors-{{ .Site.Params.scheme | default "dark" }}.css"> - - {{ partial "head.html" . }} -</head> - -<body> - <header id="header"> - <h1><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h1> - <p>{{ .Site.Params.Description }}</p> - </header> - - <div id="page"> - <div id="sidebar"> - {{ partial "navigation.html" . }} - </div> - - <div id="content"> diff --git a/layouts/partials/navigation.html b/layouts/partials/navigation.html index 29ba4e7..dfc5e4a 100644 --- a/layouts/partials/navigation.html +++ b/layouts/partials/navigation.html @@ -1,9 +1,9 @@ <nav> {{ range .Site.Menus }} - <ul class="nav"> - {{ range . }} - <li><a {{ if eq .Name "Mastodon" }}rel="me" {{ end }}href="{{ .URL }}"><span>{{ .Name }}</span></a></li> - {{ end }} - </ul> + <ul class="nav"> + {{ range . }} + <li><a {{ if eq .Name "Mastodon" }}rel="me" {{ end }}href="{{ .URL }}"><span>{{ .Name }}</span></a></li> + {{ end }} + </ul> {{ end }} -</nav>
\ No newline at end of file +</nav> diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html new file mode 100644 index 0000000..31f1074 --- /dev/null +++ b/layouts/partials/pagination.html @@ -0,0 +1,11 @@ +{{ if or .Paginator.HasPrev .Paginator.HasNext }} + <nav class="pagination" role="pagination"> + {{ if (.Paginator.HasPrev) }} + <a class="newer-posts" href="{{ .Paginator.Prev.URL }}"><span aria-hidden="true">←</span> Newer Posts</a> + {{ end }} + <span class="page-number">Page {{ .Paginator.PageNumber }} of {{ .Paginator.TotalPages }}</span> + {{ if .Paginator.HasNext }} + <a class="older-posts" href="{{ .Paginator.Next.URL }}">Older Posts <span aria-hidden="true">→</span></a> + {{ end }} + </nav> +{{ end }} |