diff options
author | He Yeshuang <yeshuanghe@gmail.com> | 2020-05-01 18:00:07 +0300 |
---|---|---|
committer | He Yeshuang <yeshuanghe@gmail.com> | 2020-05-18 15:15:49 +0300 |
commit | 2c5fd2ce2d6a51287a35e384c658b643e589ba5c (patch) | |
tree | b6c142b21718645f5acd759b478232f66f8fe9c0 /layouts | |
parent | 73a2bd7d643e437d537ce083b508c374c876e86f (diff) |
feels tired
Diffstat (limited to 'layouts')
-rwxr-xr-x | layouts/_default/baseof.html | 4 | ||||
-rwxr-xr-x | layouts/_default/list.html | 6 | ||||
-rw-r--r-- | layouts/partials/list-footer.html | 2 | ||||
-rwxr-xr-x | layouts/partials/list-header.html | 6 | ||||
-rw-r--r-- | layouts/partials/menu-contextual.html | 29 | ||||
-rwxr-xr-x | layouts/partials/page-aside.html | 1 | ||||
-rw-r--r-- | layouts/partials/page-footer.html | 20 | ||||
-rw-r--r-- | layouts/partials/page-header.html | 4 | ||||
-rw-r--r-- | layouts/partials/pagination.html | 72 | ||||
-rwxr-xr-x | layouts/partials/site-aside.html | 10 | ||||
-rwxr-xr-x | layouts/partials/site-header.html | 2 | ||||
-rw-r--r-- | layouts/partials/site-navigation.html | 16 | ||||
-rw-r--r-- | layouts/partials/summary.html | 11 | ||||
-rw-r--r-- | layouts/partials/tags.html | 4 | ||||
-rw-r--r-- | layouts/post/list.html | 23 | ||||
-rw-r--r-- | layouts/post/summary.html | 15 | ||||
-rw-r--r-- | layouts/shortcodes/fluid_img.html | 7 | ||||
-rw-r--r-- | layouts/shortcodes/fluid_imgs.html | 21 | ||||
-rw-r--r-- | layouts/shortcodes/pure_table.html | 20 | ||||
-rw-r--r-- | layouts/shortcodes/spoiler.html | 8 |
20 files changed, 186 insertions, 95 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index cacb401..00f8fa9 100755 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -44,7 +44,7 @@ {{ block "header" . }}{{ partial "site-header.html" .}}{{ end }} </div> </header> - <main role="main" class="w-full md:w-3/5 xl:w-1/2 max-w-3xl order-2 md:order-2 pt-2 pb-4"> + <main role="main" class="w-full md:w-3/5 xl:w-1/2 max-w-3xl order-2 md:order-2 min-h-70vh pt-2 pb-4"> {{ block "main" . }}{{ end }} </main> <aside role="contentinfo" class="w-full md:w-2/5 xl:w-1/2 md:pr-12 lg:pr-20 xl:pr-24 order-4 md:order-3 md:sticky md:bottom-0 self-end max-w-2xl"> @@ -52,7 +52,7 @@ {{ block "aside" . }}{{ partial "site-aside.html" . }}{{ end }} </div> </aside> - <footer class="w-full md:w-3/5 xl:w-1/2 order-3 max-w-3xl md:order-4"> + <footer class="w-full md:w-3/5 xl:w-1/2 order-3 max-w-3xl md:order-4 pt-2"> {{ block "footer" . }} {{ end }} </footer> diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 893c10b..b6c7f8f 100755 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -10,6 +10,8 @@ </div> {{ end }} </section> - {{- template "_internal/pagination.html" . -}} </article> -{{ end }}
\ No newline at end of file +{{ end }} +{{define "footer"}} +{{ partial "list-footer.html" . }} +{{end}}
\ No newline at end of file diff --git a/layouts/partials/list-footer.html b/layouts/partials/list-footer.html new file mode 100644 index 0000000..d6f0137 --- /dev/null +++ b/layouts/partials/list-footer.html @@ -0,0 +1,2 @@ +<hr class="double-line"/> +{{- partial "pagination.html" . -}}
\ No newline at end of file diff --git a/layouts/partials/list-header.html b/layouts/partials/list-header.html new file mode 100755 index 0000000..4190fd9 --- /dev/null +++ b/layouts/partials/list-header.html @@ -0,0 +1,6 @@ + <div class="pb-4"> + <h1> + <a href="{{ .Site.BaseURL }}" title="{{ .Site.Title }}" class="heading">{{ .Site.Title }}</a> + </h1> + </div> + {{ partial "site-navigation.html" . }}
\ No newline at end of file diff --git a/layouts/partials/menu-contextual.html b/layouts/partials/menu-contextual.html deleted file mode 100644 index e0d79dd..0000000 --- a/layouts/partials/menu-contextual.html +++ /dev/null @@ -1,29 +0,0 @@ -{{/* -Use Hugo's native Table of contents feature. You must set `toc: true` in your parameters for this to show. -https://gohugo.io/content-management/toc/ -*/}} - -<!-- {{- if .Params.toc -}} -<div> - <p>What's in this {{ humanize .Type }}</p> - {{ .TableOfContents }} -</div> -{{- end -}} --> - -{{/* -Use Hugo's native related content feature to pull in content that may have similar parameters, like tags. etc. -https://gohugo.io/content-management/related/ -*/}} - -{{ $related := .Site.RegularPages.Related . | first 15 }} -{{ $count := len $related }} -{{ with $related }} -<div class="font-serif"> - <span class="heading pr-4">Related</span> - {{ range $k, $v := . }} - <a href="{{ $v.RelPermalink }}"> - {{- $v.Title -}} - </a>{{ if lt $k (sub $count 1) }} /{{end}} - {{ end }} -</div> -{{ end }}
\ No newline at end of file diff --git a/layouts/partials/page-aside.html b/layouts/partials/page-aside.html index 041fa45..5dcf5d4 100755 --- a/layouts/partials/page-aside.html +++ b/layouts/partials/page-aside.html @@ -1,5 +1,6 @@ <div class="md:max-w-xs flex flex-col md:items-end"> {{ partial "site-navigation.html" . }} + {{ partial "social-follow.html" . }} <div class="text-sm text-gray-500 leading-tight"> Built with Hugo and theme Tokiwa.<br/> {{.Site.Copyright|safeHTML}} diff --git a/layouts/partials/page-footer.html b/layouts/partials/page-footer.html index 5d7b0f9..4a56555 100644 --- a/layouts/partials/page-footer.html +++ b/layouts/partials/page-footer.html @@ -1,5 +1,5 @@ <hr class="double-line" /> -<div class="flex flex-wrap justify-between pb-2 font-serif"> +<div class="flex flex-wrap justify-between pb-2 leading-loose font-serif"> {{with .Site.RegularPages.Prev . }} <a class="flex-grow-0" href="{{.RelPermalink}}"> <svg class="fill-current inline-block h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" @@ -19,9 +19,23 @@ {{end}} </div> <div > - {{- partial "menu-contextual.html" . -}} +{{ $related := .Site.RegularPages.Related . | first 15 }} +{{ $count := len $related }} +{{ with $related }} +<div class="font-serif pb-2 flex align-start leading-loose"> + <span class="heading pr-6 leading-loose">Related</span> + <span > + {{ range $k, $v := . }} + <a href="{{ $v.RelPermalink }}"> + {{- $v.Title -}} + </a>{{ if lt $k (sub $count 1) }} / {{end}} + {{ end }} +</span> +</div> +{{ end }} </div> <hr /> <div class="pb-2"> {{ template "_internal/disqus.html" . }} -</div>
\ No newline at end of file +</div> +<hr />
\ No newline at end of file diff --git a/layouts/partials/page-header.html b/layouts/partials/page-header.html index 7cfe63d..8228ce3 100644 --- a/layouts/partials/page-header.html +++ b/layouts/partials/page-header.html @@ -11,9 +11,9 @@ {{end}} <div class="flex flex-wrap justify-end pt-2 "> {{- partial "tags.html" . -}} - <time class="text-eucalyptus-500 md:text-right md:flex-grow font-light" + <time class="text-eucalyptus-500 md:text-right md:flex-grow font-light pl-4" datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}"> - {{- .Date.Format "2006年1月2日" -}} + {{- .Date.Format "2006-1-2 15:04" -}} </time> </div> <hr />
\ No newline at end of file diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html new file mode 100644 index 0000000..b5e06d6 --- /dev/null +++ b/layouts/partials/pagination.html @@ -0,0 +1,72 @@ +{{ $pag := $.Paginator }} +{{ if gt $pag.TotalPages 1 }} +<ul class="flex justify-between"> + {{ with $pag.First }} + <li class="page-item"> + <a href="{{ .URL }}" class="page-link" aria-label="First"><span aria-hidden="true"> + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" + stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" + class="feather feather-chevrons-left h-4 w-4 relative -bottom-1"> + <polyline points="11 17 6 12 11 7"></polyline> + <polyline points="18 17 13 12 18 7"></polyline> + </svg> + </span></a> + </li> + {{ end }} + <li class="page-item{{ if not $pag.HasPrev }} disabled{{ end }}"> + <a {{ if $pag.HasPrev }}href="{{ $pag.Prev.URL }}" {{ end }} class="page-link" aria-label="Previous"><span + aria-hidden="true"> + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" + stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" + class="feather feather-chevron-left h-4 w-4 relative -bottom-1"> + <polyline points="15 18 9 12 15 6"></polyline> + </svg> + </span></a> + </li> + <div class="flex-grow-3"></div> + {{ $ellipsed := false }} + {{ $shouldEllipse := false }} + {{ range $pag.Pagers }} + {{ $right := sub .TotalPages .PageNumber }} + {{ $showNumber := or (le .PageNumber 3) (eq $right 0) }} + {{ $showNumber := or $showNumber (and (gt .PageNumber (sub $pag.PageNumber 2)) (lt .PageNumber (add $pag.PageNumber 2))) }} + {{ if $showNumber }} + {{ $ellipsed = false }} + {{ $shouldEllipse = false }} + {{ else }} + {{ $shouldEllipse = not $ellipsed }} + {{ $ellipsed = true }} + {{ end }} + {{ if $showNumber }} + <li class="page-item{{ if eq . $pag }} active{{ end }}"><a class="page-link" href="{{ .URL }}">{{ .PageNumber }}</a> + </li> + {{ else if $shouldEllipse }} + <li class="page-item disabled"><span aria-hidden="true"> … </span></li> + {{ end }} + {{ end }} + <div class="flex-grow-3"></div> + <li class="page-item{{ if not $pag.HasNext }} disabled{{ end }}"> + <a {{ if $pag.HasNext }}href="{{ $pag.Next.URL }}" {{ end }} class="page-link" aria-label="Next"><span + aria-hidden="true"> + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" + stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" + class="feather feather-chevron-right h-4 w-4 relative -bottom-1"> + <polyline points="9 18 15 12 9 6"></polyline> + </svg> + </span></a> + </li> + {{ with $pag.Last }} + <li class="page-item"> + <a href="{{ .URL }}" class="page-link" aria-label="Last"><span aria-hidden="true"> + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" + stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" + class="feather feather-chevrons-right h-4 w-4 relative -bottom-1"> + <polyline points="13 17 18 12 13 7"></polyline> + <polyline points="6 17 11 12 6 7"></polyline> + </svg> + </span></a> + </li> + {{ end }} +</ul> +{{ end }} + diff --git a/layouts/partials/site-aside.html b/layouts/partials/site-aside.html index a35c438..f95d08b 100755 --- a/layouts/partials/site-aside.html +++ b/layouts/partials/site-aside.html @@ -1,3 +1,7 @@ -<a href="{{ .Site.BaseURL }}"> - © {{ now.Format "2006" }} {{ .Site.Title }} -</a>
\ No newline at end of file +<div class="md:max-w-xs flex flex-col md:items-end"> + {{ partial "social-follow.html" . }} + <div class="text-sm text-gray-500 leading-tight"> + Built with Hugo and theme Tokiwa.<br/> + {{.Site.Copyright|safeHTML}} + </div> +</div>
\ No newline at end of file diff --git a/layouts/partials/site-header.html b/layouts/partials/site-header.html index e22c832..4190fd9 100755 --- a/layouts/partials/site-header.html +++ b/layouts/partials/site-header.html @@ -1,6 +1,6 @@ <div class="pb-4"> <h1> - {{ .Site.Title }} + <a href="{{ .Site.BaseURL }}" title="{{ .Site.Title }}" class="heading">{{ .Site.Title }}</a> </h1> </div> {{ partial "site-navigation.html" . }}
\ No newline at end of file diff --git a/layouts/partials/site-navigation.html b/layouts/partials/site-navigation.html index 5e756d0..0e7601e 100644 --- a/layouts/partials/site-navigation.html +++ b/layouts/partials/site-navigation.html @@ -1,6 +1,5 @@ -<div class="font-serif"> - {{ if .Site.Menus.main }} - <ul > + <ul class="font-serif flex-grow-0 flex justify-between flex-wrap md:flex-col"> + {{ if .Site.Menus.main }} {{ range .Site.Menus.main }} <li> <a href="{{ .URL }}" title="{{ .Name }} page"> @@ -8,7 +7,10 @@ </a> </li> {{ end }} - </ul> - {{ end }} -</div> -{{ partial "social-follow.html" . }}
\ No newline at end of file + {{ if .OutputFormats.Get "RSS" }} + <li> + <a href='{{ with .OutputFormats.Get "RSS" }}{{ .RelPermalink }}{{ end }}'>RSS</a> + </li> + {{ end }} + {{ end }} + </ul>
\ No newline at end of file diff --git a/layouts/partials/summary.html b/layouts/partials/summary.html index 9f30c0f..55ebacc 100644 --- a/layouts/partials/summary.html +++ b/layouts/partials/summary.html @@ -1,13 +1,12 @@ <div> <div> - <span>{{ humanize .Section }}</span> - <h1> + <div> <a href="{{ .Permalink }}"> {{ .Title }} </a> - </h1> - <div> - {{ .Summary }} - </div> + </div> + {{ with .Description }} + <div>{{.}}</div> + {{ end }} </div> </div>
\ No newline at end of file diff --git a/layouts/partials/tags.html b/layouts/partials/tags.html index 2111cc6..a7088a8 100644 --- a/layouts/partials/tags.html +++ b/layouts/partials/tags.html @@ -4,8 +4,8 @@ {{ if gt $count 0 }} {{ range $k, $v := .Params.categories}} <a class="post-taxonomy-category text-medium-red-violet-600 hover:text-medium-red-violet-400" - href="/categories/{{ . | urlize }}">{{ . }}</a>{{ if lt $k (sub $count 1) }} /{{ end }} - {{end}} + href="/categories/{{ . | urlize }}">{{ . }}</a> / + {{end}} {{end}} {{end}} {{ if isset .Params "tags" }} diff --git a/layouts/post/list.html b/layouts/post/list.html deleted file mode 100644 index f41c6bd..0000000 --- a/layouts/post/list.html +++ /dev/null @@ -1,23 +0,0 @@ -{{ define "main" }} -{{/* -This template is the same as the default and is here to demonstrate that if you have a content directory called "post" -you can create a layouts directory, just for that section. -*/}} -<article> - <section> - {{ .Content }} - </section> - <aside> - {{ range .Paginator.Pages }} - <div> - {{/* - Note we can use `.Render` here for items just in this section, instead of a partial to pull in items for the list - page. https://gohugo.io/functions/render/ - */}} - {{ .Render "summary" }} - </div> - {{ end }} - </aside> - {{ template "_internal/pagination.html" . }} -</article> -{{ end }}
\ No newline at end of file diff --git a/layouts/post/summary.html b/layouts/post/summary.html deleted file mode 100644 index bbde4a7..0000000 --- a/layouts/post/summary.html +++ /dev/null @@ -1,15 +0,0 @@ -<div> - {{ if .Date }} - <div> - {{ .Date.Format "January 2, 2006" }} - </div> - {{ end }} - <h1> - <a href="{{ .Permalink }}"> - {{ .Title }} - </a> - </h1> - <div> - {{ .Summary }} - </div> -</div>
\ No newline at end of file diff --git a/layouts/shortcodes/fluid_img.html b/layouts/shortcodes/fluid_img.html new file mode 100644 index 0000000..6930dd9 --- /dev/null +++ b/layouts/shortcodes/fluid_img.html @@ -0,0 +1,7 @@ +{{ if .IsNamedParams }} +<div class="{{ if .Get "class" }}{{ .Get "class" }}{{ else }}pure-u-1{{ end }}"> + <img class="pure-img" src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}"{{ end }}> +</div> +{{ else }} +<img class="pure-img" src="{{ index .Params 0 }}" alt=""> +{{ end }}
\ No newline at end of file diff --git a/layouts/shortcodes/fluid_imgs.html b/layouts/shortcodes/fluid_imgs.html new file mode 100644 index 0000000..f899772 --- /dev/null +++ b/layouts/shortcodes/fluid_imgs.html @@ -0,0 +1,21 @@ +{{ $paramCount := len .Params }} +{{ if gt $paramCount 0 }} +<div class="pure-g"> +{{ range $param := .Params }} + {{ $items := split $param "|" }} + {{ $itemCount := len $items }} + <!-- Item count must be at least 2 as + "class" and "src" must be specified --> + {{ if ge $itemCount 2 }} + <div class="{{ index $items 0 }}"> + <div style="padding: 0 .2em"> + <img + class="pure-img-responsive" + src="{{ index $items 1 }}" + alt="{{ if ge $itemCount 3 }}{{ index $items 2 }}{{ else }}{{ "" }}{{ end }}"> + </div> + </div> + {{ end }} +{{ end }} +</div> +{{ end }}
\ No newline at end of file diff --git a/layouts/shortcodes/pure_table.html b/layouts/shortcodes/pure_table.html new file mode 100644 index 0000000..91236bc --- /dev/null +++ b/layouts/shortcodes/pure_table.html @@ -0,0 +1,20 @@ +{{ $fields := (index .Params 0) }} +{{ $data := after 1 .Params }} + +<table class="pure-table pure-table-striped"> + <thead><tr> + {{ range split $fields "|"}} + <th>{{ . }}</th> + {{ end }} + </thead></tr> + <tbody> + {{ range $data}} + <tr> + {{ $items := split . "|" }} + {{ range $items }} + <td>{{ . }}</td> + {{ end }} + </tr> + {{ end }} + </tbody> +</table>
\ No newline at end of file diff --git a/layouts/shortcodes/spoiler.html b/layouts/shortcodes/spoiler.html new file mode 100644 index 0000000..b3f4cb9 --- /dev/null +++ b/layouts/shortcodes/spoiler.html @@ -0,0 +1,8 @@ +<details> +<summary> + <h4 class="inline"> + {{ with .Get 0}}{{.}}{{else}}click to expand{{ end }} + </h4> +</summary> +{{.Inner}} +</details> |