diff options
Diffstat (limited to 'themes/mypaper/layouts')
| -rw-r--r-- | themes/mypaper/layouts/404.html | 3 | ||||
| -rw-r--r-- | themes/mypaper/layouts/_default/list.html | 45 | ||||
| -rw-r--r-- | themes/mypaper/layouts/_default/single.html | 45 | ||||
| -rw-r--r-- | themes/mypaper/layouts/partials/footer.html | 14 | ||||
| -rw-r--r-- | themes/mypaper/layouts/partials/header.html | 55 | ||||
| -rw-r--r-- | themes/mypaper/layouts/shortcodes/collapse.html | 12 |
6 files changed, 174 insertions, 0 deletions
diff --git a/themes/mypaper/layouts/404.html b/themes/mypaper/layouts/404.html new file mode 100644 index 0000000..ab966ff --- /dev/null +++ b/themes/mypaper/layouts/404.html @@ -0,0 +1,3 @@ +{{- partial "header.html" . }} +<div class="not-found">404</div> +{{- partial "footer.html" . }} diff --git a/themes/mypaper/layouts/_default/list.html b/themes/mypaper/layouts/_default/list.html new file mode 100644 index 0000000..30acea5 --- /dev/null +++ b/themes/mypaper/layouts/_default/list.html @@ -0,0 +1,45 @@ +{{- partial "header.html" . }} + +{{- $scope := .Site }} +{{- if .Title }} +<header class="page-header"><h1>{{ .Title }}</h1></header>{{ $scope = . }} +{{ end }} + +{{- $paginator := .Paginate (where $scope.RegularPages ".Params.type" "!=" "page") }} + +{{- range $index, $page := $paginator.Pages }} + +{{- $class := "post-entry" }} +{{- if (and $.IsHome (eq $paginator.PageNumber 1) (eq $index 0)) }} +{{- $class = "first-entry" }} +{{- else if .Data.Term }} +{{- $class = "post-entry tag-entry" }} +{{- end }} +<article class="{{ $class }}"> + <header class="entry-header"> + <h2>{{ .Title }}</h2> + </header> + <section class="entry-content"> + <p>{{ .Summary | plainify | htmlUnescape }}...</p> + </section> + <footer class="entry-footer"> + <time>{{ .Date.Format "January 2, 2006" }}</time> + </footer> + <a class="entry-link" href="{{ .Permalink }}"></a> +</article> +{{- end }} + +{{- if gt $paginator.TotalPages 1 }} +<footer class="page-footer"> + <nav class="pagination"> + {{- if $paginator.HasPrev }} + <a class="prev" href="{{ $paginator.Prev.URL }}">← {{ i18n "prev_page" }}</a> + {{- end }} + {{- if $paginator.HasNext }} + <a class="next" href="{{ $paginator.Next.URL }}">{{ i18n "next_page" }} →</a> + {{- end }} + </nav> +</footer> +{{- end }} + +{{- partial "footer.html" . }} diff --git a/themes/mypaper/layouts/_default/single.html b/themes/mypaper/layouts/_default/single.html new file mode 100644 index 0000000..103f9a1 --- /dev/null +++ b/themes/mypaper/layouts/_default/single.html @@ -0,0 +1,45 @@ +{{- partial "header.html" . }} + +<article class="post-single"> + <header class="post-header"> + <h1 class="post-title">{{ .Title }}</h1> + <div class="post-meta"> + {{- if or .Params.Author .Site.Author.name }} + {{- .Params.Author | default .Site.Author.name }} · {{ end }} + {{- .Date.Format "January 2, 2006" -}} + </div> + </header> + <div class="post-content">{{ .Content }}</div> + {{- if .Params.tags }} + <footer class="post-footer"> + <ul class="post-tags"> + {{- range .Params.tags }} + {{- $href := print (absURL "tags/") (urlize .) }} + <li><a href="{{ $href }}">{{ . }}</a></li> + {{- end }} + </ul> + </footer> + {{- end }} + <!-- Comments area start --> + {{- if not (eq .Params.comments false) }} + {{- if .Site.DisqusShortname }} + <div id="disqus_thread"></div> + <script> + var disqus_shortname = '{{ .Site.DisqusShortname }}'; + (function() { + var d = document, s = d.createElement('script'); + s.src = 'https://' + disqus_shortname + '.disqus.com/embed.js'; + s.setAttribute('data-timestamp', +new Date()); + (d.head || d.body).appendChild(s); + })(); + </script> + <noscript> + Please enable JavaScript to view the + <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a> + </noscript> + <!-- Comments area end --> + {{- end }} + {{- end }} +</article> + +{{- partial "footer.html" . }} diff --git a/themes/mypaper/layouts/partials/footer.html b/themes/mypaper/layouts/partials/footer.html new file mode 100644 index 0000000..ebc84ef --- /dev/null +++ b/themes/mypaper/layouts/partials/footer.html @@ -0,0 +1,14 @@ +</main> +<footer class="footer"> + <span>© {{ now.Year }} <a href="{{ "" | absURL }}">{{ .Site.Title }}</a></span> + <span>·</span> + <span>Powered by <a href="https://gohugo.io/" rel="noopener" target="_blank">Hugo️️</a>️</span> + <span>·</span> + <span>Theme️ <a href="https://github.com/nanxiaobei/hugo-paper" rel="noopener" target="_blank">Paper</a></span> +</footer> +<script src="{{ "highlight.min.js" | absURL }}"></script> +<script> + hljs.initHighlightingOnLoad(); +</script> +</body> +</html> diff --git a/themes/mypaper/layouts/partials/header.html b/themes/mypaper/layouts/partials/header.html new file mode 100644 index 0000000..9e56cac --- /dev/null +++ b/themes/mypaper/layouts/partials/header.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<html lang="{{ .Site.LanguageCode }}"> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <!-- Title --> + <title>{{ if .Title }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title> + <!-- Meta --> + {{- if eq .Kind "page" }} + <meta name="description" content="{{ .Summary }}"> + <meta name="author" content="{{ .Params.Author | default .Site.Author.name }}"> + {{- else }} + <meta name="description" content="{{ .Site.Params.description }}"> + <meta name="author" content="{{ .Site.Author.name }}"> + {{- end }} + <!-- Styles --> + <link href="{{ "an-old-hope.min.css" | absURL }}" rel="stylesheet"> + <link href="{{ "style.css" | absURL }}" rel="stylesheet"> + <link href="{{ "custom.css" | absURL }}" rel="stylesheet"> + <!-- Favicons --> + <link rel="apple-touch-icon" href="{{ "apple-touch-icon.png" | absURL }}"> + <link rel="icon" href="{{ "favicon.ico" | absURL }}"> + <!-- Generator --> + {{- hugo.Generator }} + <!-- RSS --> + {{ range .AlternativeOutputFormats -}} + {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} + {{ end -}} + <!-- Misc --> + {{- if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }} + {{- template "_internal/google_analytics_async.html" . }} + {{- template "_internal/opengraph.html" . }} + {{- end }} + </head> + <body class="{{ if eq .Kind `page` }}single{{ else }}list{{ if .IsHome }} home{{ end }}{{ end }}"> + <header class="header"> + <nav class="nav"> + {{- if .IsHome }} + <h1 class="logo"><a href="{{ "" | absURL }}">{{ .Site.Title }}</a></h1> + {{- else }} + <p class="logo"><a href="{{ "" | absURL }}">{{ .Site.Title }}</a></p> + {{- end }} + {{- if .Site.Menus.main }} + <ul class="menu"> + {{- range .Site.Menus.main }} + <li> + <a href="{{ .URL }}">{{ .Name }}</a> + </li> + {{- end }} + </ul> + {{- end }} + </nav> + </header> + <main class="main"> diff --git a/themes/mypaper/layouts/shortcodes/collapse.html b/themes/mypaper/layouts/shortcodes/collapse.html new file mode 100644 index 0000000..b92ad01 --- /dev/null +++ b/themes/mypaper/layouts/shortcodes/collapse.html @@ -0,0 +1,12 @@ +{{ if .Get "content" }} +{{ if .Get "summary" }} +{{ else }} +{{ warnf "missing value for param 'summary': %s" .Position }} +{{ end }} +{{ else }} +{{ errorf "missing value for param 'content': %s" .Position }} +{{ end }} +<p><details {{ if (eq (.Get "openByDefault") true) }} open=true {{ end }}> + <summary markdown="span">{{ .Get "summary" | markdownify }}</summary> + {{ .Get "content" | markdownify }} +</details></p> |
