diff options
author | Sean Lane <git@sean.lane.sh> | 2019-01-21 01:47:31 +0300 |
---|---|---|
committer | Sean Lane <git@sean.lane.sh> | 2019-01-21 01:47:31 +0300 |
commit | 44ed9f8525292012115df5e57613dda4fdc44071 (patch) | |
tree | 88ffb8785c3a3ce16a0ff9b969dce6a7e113e72a /layouts |
Initial commit
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/404.html | 3 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 44 | ||||
-rw-r--r-- | layouts/_default/list.html | 11 | ||||
-rw-r--r-- | layouts/_default/single.html | 6 | ||||
-rw-r--r-- | layouts/index.html | 3 | ||||
-rw-r--r-- | layouts/partials/404.html | 7 | ||||
-rw-r--r-- | layouts/partials/footer.html | 14 | ||||
-rw-r--r-- | layouts/partials/header.html | 9 | ||||
-rw-r--r-- | layouts/partials/home.html | 1 | ||||
-rw-r--r-- | layouts/partials/list.html | 21 | ||||
-rw-r--r-- | layouts/partials/page.html | 8 | ||||
-rw-r--r-- | layouts/partials/pagination.html | 48 | ||||
-rw-r--r-- | layouts/partials/posts/disqus.html | 3 | ||||
-rw-r--r-- | layouts/partials/taxonomy/categories.html | 9 | ||||
-rw-r--r-- | layouts/partials/taxonomy/tags.html | 9 | ||||
-rw-r--r-- | layouts/posts/list.html | 21 | ||||
-rw-r--r-- | layouts/posts/single.html | 38 |
17 files changed, 255 insertions, 0 deletions
diff --git a/layouts/404.html b/layouts/404.html new file mode 100644 index 0000000..23ecb19 --- /dev/null +++ b/layouts/404.html @@ -0,0 +1,3 @@ +{{ define "content" }} + {{ partial "404.html" . }} +{{ end }} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..b925300 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,44 @@ +<!DOCTYPE html> +<html lang="{{ .Site.LanguageCode }}"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + {{ with .Site.Params.author }}<meta name="author" content="{{ . }}">{{ end }} + {{ with .Site.Params.description }}<meta name="description" content="{{ . }}">{{ end }} + {{ with .Site.Params.keywords }}<meta name="keywords" content="{{ . }}">{{ end }} + + <title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title> + + <link rel="canonical" href="{{ .Permalink }}"> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css" integrity="sha256-oSrCnRYXvHG31SBifqP2PM1uje7SJUyX0nTwO2RJV54=" crossorigin="anonymous" /> + <link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css" integrity="sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous"> + <link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/grids-responsive-min.css"> + {{ if .Site.IsServer }} + {{ $cssOpts := (dict "targetPath" "css/gochowdown.css" "enableSourceMap" true ) }} + {{ $styles := resources.Get "scss/gochowdown.scss" | resources.ExecuteAsTemplate "style.gochowdown.css" . | toCSS $cssOpts }} + <link rel="stylesheet" href="{{ $styles.RelPermalink }}" media="screen"> + {{ else }} + {{ $cssOpts := (dict "targetPath" "css/gochowdown.css" ) }} + {{ $styles := resources.Get "scss/gochowdown.scss" | resources.ExecuteAsTemplate "style.gochowdown.css" . | toCSS $cssOpts | minify | fingerprint }} + <link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Integrity }}" crossorigin="anonymous" media="screen" /> + {{ end }} + + {{ range .Site.Params.custom_css }} + <link rel="stylesheet" href="{{ . | absURL }}"> + {{ end }} + + <link rel="icon" type="image/png" href="{{ .Site.Params.favicon_32 | default "/images/favicon-32x32.png" | absURL }}" sizes="32x32"> + <link rel="icon" type="image/png" href="{{ .Site.Params.favicon_16 | default "/images/favicon-16x16.png" | absURL }}" sizes="16x16"> + {{ .Hugo.Generator }} + </head> + <body> + {{ partial "header.html" . }} + <main class="content"> + {{ block "content" . }}{{ end }} + </main> + {{ partial "footer.html" . }} + {{ if .Site.googleAnalytics }} + {{ template "_internal/google_analytics.html" . }} + {{ end }} + </body> +</html>
\ No newline at end of file diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..d62bc46 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,11 @@ +{{ define "title" }} + {{- if eq .Kind "taxonomy" -}} + {{- .Data.Singular | title -}} + {{- print ": " -}} + {{- end -}} + + {{- .Title }} · {{ .Site.Title -}} +{{ end }} +{{ define "content" }} + {{ partial "list.html" . }} +{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..93ec22c --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,6 @@ +{{ define "title" }} + {{ .Title }} · {{ .Site.Title }} +{{ end }} +{{ define "content" }} + {{ partial "page.html" . }} +{{ end }} diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..b829b61 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,3 @@ +{{ define "content" }} + {{ partial "home.html" . }} +{{ end }} diff --git a/layouts/partials/404.html b/layouts/partials/404.html new file mode 100644 index 0000000..c59f598 --- /dev/null +++ b/layouts/partials/404.html @@ -0,0 +1,7 @@ +<section class="container centered"> + <div class="error"> + <h1>HTTP Error 404</h1> + <h2>Page Not Found</h2> + <p>Sorry, this page does not exist.<br />You can head back to <a href="{{ .Site.BaseURL }}">homepage</a>.</p> + </div> +</section> diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..1f02266 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,14 @@ +<footer class="footer"> + {{ with .Site.Params.footercontent }} + <p>{{.}}</p> + {{ end }} + {{ if not .Site.Params.hideCopyright }} © {{ now.Format "2006" }}{{ end }} + {{ if not .Site.Params.hideCredits }} + {{ if not .Site.Params.hideCopyright }} · {{ end }} + Powered by <a href="https://gohugo.io/">Hugo</a> & <a href="https://github.com/seanlane/gochowdown">GoChowdown</a> + {{ end }} + {{ if .Site.Params.commit }} + {{ if or (not .Site.Params.hideCredits) (not .Site.Params.hideCopyright) }} · {{ end }} + [<a href="{{ .Site.Params.commit }}{{ getenv "GIT_COMMIT_SHA" }}">{{ getenv "GIT_COMMIT_SHA_SHORT" }}</a>] + {{ end }} +</footer> diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..b83b027 --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,9 @@ +<nav class="navigation pure-g"> + <section class="pure-u-1 nav-right"> + {{ with .Site.Menus.main}} + {{ range . }} + <a href="{{ .URL | relLangURL }}">{{ .Name }}</a> + {{ end }} + {{ end }} + </section> +</nav> diff --git a/layouts/partials/home.html b/layouts/partials/home.html new file mode 100644 index 0000000..fb3ffc2 --- /dev/null +++ b/layouts/partials/home.html @@ -0,0 +1 @@ +{{ .Content }}
\ No newline at end of file diff --git a/layouts/partials/list.html b/layouts/partials/list.html new file mode 100644 index 0000000..233584f --- /dev/null +++ b/layouts/partials/list.html @@ -0,0 +1,21 @@ +<section class="container list"> + <h1 class="title"> + {{- if eq .Kind "taxonomy" -}} + {{- .Data.Singular | title -}} + {{- print ": " -}} + {{- end -}} + + {{- .Title -}} + </h1> + {{ range .Paginator.Pages }} + <div class="pure-g"> + <div class="pure-u-1-3"> + {{ .Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }} + </div> + <div class="pure-u-2-3"> + <a href="{{ .URL }}">{{ .Title }}</a> + </div> + </div> + {{ end }} + {{ partial "pagination.html" . }} +</section> diff --git a/layouts/partials/page.html b/layouts/partials/page.html new file mode 100644 index 0000000..dc492ee --- /dev/null +++ b/layouts/partials/page.html @@ -0,0 +1,8 @@ +<section class="container page"> + <article> + <header> + <h1>{{ .Title }}</h1> + </header> + {{ .Content }} + </article> +</section> diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html new file mode 100644 index 0000000..1e004b8 --- /dev/null +++ b/layouts/partials/pagination.html @@ -0,0 +1,48 @@ +{{ $paginator := .Paginator }} +{{ $adjacent_links := 2 }} +{{ $max_links := (add (mul $adjacent_links 2) 1) }} +{{ $lower_limit := (add $adjacent_links 1) }} +{{ $upper_limit := (sub $paginator.TotalPages $adjacent_links) }} +{{ if gt $paginator.TotalPages 1 }} +<ul class="pagination"> + {{ if $paginator.HasPrev }} + {{ if ne $paginator.PageNumber 1 }} + <li><a href="{{ $paginator.First.URL }}">«</a></li> + {{ end }} + <li class="hidden"><a href="{{ $paginator.Prev.URL }}">‹</a></li> + {{ end }} + {{ range $paginator.Pagers }} + {{ $.Scratch.Set "page_number_flag" false }} + {{ if gt $paginator.TotalPages $max_links }} + {{ if le $paginator.PageNumber $lower_limit }} + {{ if le .PageNumber $max_links }} + {{ $.Scratch.Set "page_number_flag" true }} + {{ end }} + {{ else if ge $paginator.PageNumber $upper_limit }} + {{ if gt .PageNumber (sub $paginator.TotalPages $max_links) }} + {{ $.Scratch.Set "page_number_flag" true }} + {{ end }} + {{ else }} + {{ if and ( ge .PageNumber (sub $paginator.PageNumber $adjacent_links) ) ( le .PageNumber (add $paginator.PageNumber $adjacent_links) ) }} + {{ $.Scratch.Set "page_number_flag" true }} + {{ end }} + {{ end }} + {{ else }} + {{ $.Scratch.Set "page_number_flag" true }} + {{ end }} + {{ if eq ($.Scratch.Get "page_number_flag") true }} + {{ if eq . $paginator }} + <li>{{ .PageNumber }}</li> + {{ else }} + <li><a href="{{ .URL }}">{{ .PageNumber }}</a></li> + {{ end }} + {{ end }} + {{ end }} + {{ if $paginator.HasNext }} + <li class="hidden"><a href="{{ $paginator.Next.URL }}">›</a></li> + {{ if ne $paginator.PageNumber $paginator.TotalPages }} + <li><a href="{{ $paginator.Last.URL }}">»</a></li> + {{ end }} + {{ end }} +</ul> +{{ end }} diff --git a/layouts/partials/posts/disqus.html b/layouts/partials/posts/disqus.html new file mode 100644 index 0000000..2f1e5b4 --- /dev/null +++ b/layouts/partials/posts/disqus.html @@ -0,0 +1,3 @@ +{{- if and (not (eq .Site.DisqusShortname "" )) (eq (.Params.disable_comments | default false) false) -}} + {{ template "_internal/disqus.html" . }} +{{- end -}} diff --git a/layouts/partials/taxonomy/categories.html b/layouts/partials/taxonomy/categories.html new file mode 100644 index 0000000..1dfa641 --- /dev/null +++ b/layouts/partials/taxonomy/categories.html @@ -0,0 +1,9 @@ +<div class="categories"> + <i class="fas fa-folder"></i> + {{- range $index, $el := . -}} + {{- if gt $index 0 }} + <span class="separator">•</span> + {{- end }} + <a href="{{ ( printf "categories/%s/" ( . | urlize ) ) | relLangURL }}">{{ . }}</a> + {{- end -}} +</div> diff --git a/layouts/partials/taxonomy/tags.html b/layouts/partials/taxonomy/tags.html new file mode 100644 index 0000000..4f64ab8 --- /dev/null +++ b/layouts/partials/taxonomy/tags.html @@ -0,0 +1,9 @@ +<div class="tags"> + <i class="fas fa-tag"></i> + {{- range $index, $el := . -}} + {{- if gt $index 0 }} + <span class="separator">•</span> + {{- end }} + <a href="{{ ( printf "tags/%s/" ( . | urlize | lower ) ) | relLangURL }}">{{ . }}</a> + {{- end -}} +</div> diff --git a/layouts/posts/list.html b/layouts/posts/list.html new file mode 100644 index 0000000..170217d --- /dev/null +++ b/layouts/posts/list.html @@ -0,0 +1,21 @@ +{{ define "title" }} + {{ .Title }} · {{ .Site.Title }} +{{ end }} +{{ define "content" }} + <section class="container list"> + <h1 class="title">{{ .Title }}</h1> + {{ range $i, $page := .Paginator.Pages }} + {{ if $i }}<hr/> {{ end }} + <div class="pure-g flex-center"> + <div class="pure-u-1 pure-u-sm-2-3"> + <h3 class="post-list-title"><a href="{{ $page.URL }}">{{ $page.Title }}</a></h3> + </div> + <div class="pure-u-1 pure-u-sm-1-3 post-right"> + <p>{{ $page.Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }}</p> + </div> + </div> + <p>{{ $page.Summary }}</p> + {{ end }} + {{ partial "pagination.html" . }} + </section> +{{ end }} diff --git a/layouts/posts/single.html b/layouts/posts/single.html new file mode 100644 index 0000000..774009f --- /dev/null +++ b/layouts/posts/single.html @@ -0,0 +1,38 @@ +{{ define "title" }} + {{ .Title }} · {{ .Site.Title }} +{{ end }} +{{ define "content" }} + <section class="container post"> + <article> + <header> + <div class="post-title"> + <h1 class="title">{{ .Title }}</h1> + </div> + <div class="post-meta pure-g"> + <div class="posted-on pure-u-1 pure-u-sm-1-3"> + <i class="fas fa-calendar"></i> + <time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'> + {{ .Date.Format (.Site.Params.dateFormat | default "January 2, 2006" ) }} + </time> + </div> + <div class="reading-time pure-u-1 pure-u-sm-1-3 post-center"> + <i class="fas fa-clock"></i> + {{ i18n "readingTime" .ReadingTime }} + </div> + <div class="pure-u-1 pure-u-sm-1-3 post-right"> + {{ with .Page.Params.Categories }}{{ partial "taxonomy/categories" . }}{{ end }} + {{ with .Page.Params.Tags }}{{ partial "taxonomy/tags" . }}{{ end }} + </div> + </div> + </header> + <div> + {{ .Content }} + </div> + {{ partial "posts/gh-comments" . }} + <footer> + {{ partial "posts/disqus" . }} + </footer> + </article> + {{ partial "posts/math" . }} + </section> +{{ end }} |