diff options
| author | 2024-08-02 13:23:35 +0800 | |
|---|---|---|
| committer | 2024-08-02 13:23:35 +0800 | |
| commit | e03422873a1788137f120d9c8f34b2be079f0aee (patch) | |
| tree | f52775951aed0c594a6b1ca4c9432f3bba74ecac /themes/hugo-xmag/layouts | |
| parent | 2b8db24f956ad99305860c2f8f4cd3a331a76dc6 (diff) | |
| download | journal-e03422873a1788137f120d9c8f34b2be079f0aee.tar.gz journal-e03422873a1788137f120d9c8f34b2be079f0aee.zip | |
docs: build with hugo
Diffstat (limited to 'themes/hugo-xmag/layouts')
| -rw-r--r-- | themes/hugo-xmag/layouts/404.html | 9 | ||||
| -rw-r--r-- | themes/hugo-xmag/layouts/_default/list.html | 52 | ||||
| -rw-r--r-- | themes/hugo-xmag/layouts/_default/single.html | 41 | ||||
| -rw-r--r-- | themes/hugo-xmag/layouts/_default/terms.html | 22 | ||||
| -rw-r--r-- | themes/hugo-xmag/layouts/partials/author.html | 25 | ||||
| -rw-r--r-- | themes/hugo-xmag/layouts/partials/author_names.html | 1 | ||||
| -rw-r--r-- | themes/hugo-xmag/layouts/partials/banner.html | 7 | ||||
| -rw-r--r-- | themes/hugo-xmag/layouts/partials/comments.html | 0 | ||||
| -rw-r--r-- | themes/hugo-xmag/layouts/partials/foot_custom.html | 0 | ||||
| -rw-r--r-- | themes/hugo-xmag/layouts/partials/footer.html | 34 | ||||
| -rw-r--r-- | themes/hugo-xmag/layouts/partials/head_custom.html | 1 | ||||
| -rw-r--r-- | themes/hugo-xmag/layouts/partials/header.html | 41 | ||||
| -rw-r--r-- | themes/hugo-xmag/layouts/partials/info.html | 0 | ||||
| -rw-r--r-- | themes/hugo-xmag/layouts/partials/meta.html | 0 | ||||
| -rw-r--r-- | themes/hugo-xmag/layouts/partials/prev_next.html | 6 |
15 files changed, 239 insertions, 0 deletions
diff --git a/themes/hugo-xmag/layouts/404.html b/themes/hugo-xmag/layouts/404.html new file mode 100644 index 0000000..c7d0697 --- /dev/null +++ b/themes/hugo-xmag/layouts/404.html @@ -0,0 +1,9 @@ +{{ partial "header.html" . }} + +<div class="container"> +<main> +<h1>404 NOT FOUND</h1> +</main> +</div> + +{{ partial "footer.html" . }} diff --git a/themes/hugo-xmag/layouts/_default/list.html b/themes/hugo-xmag/layouts/_default/list.html new file mode 100644 index 0000000..5c1ac2c --- /dev/null +++ b/themes/hugo-xmag/layouts/_default/list.html @@ -0,0 +1,52 @@ +{{ partial "header.html" . }} + +<div class="container"> +<main class="list"> +{{ $pages := .Pages }} +{{ if .IsHome }}{{ $pages = .Site.RegularPages }}{{ end }} +{{ $paginator := .Paginate (where $pages "Section" "!=" "") }} +{{ range $paginator.Pages }} +<section class="article-list"> + <div class="categories"> + {{ with .Params.categories }} + {{ range first 1 . }} + <a href="{{ relURL (print "/categories/" . | urlize) }}">{{ . }}</a> + {{ end }} + {{ else }} + <a>{{ default "Uncategorized" .Site.Params.text.uncategorized }}</a> + {{ end }} + </div> + <h1><a href="{{ .RelPermalink }}">{{ .Title }}</a></h1> + <div class="date-author"> + {{ if .Params.author }}<span class="author">{{ partial "author_names.html" . }}</span> / {{ end }} + <span class="date">{{ .Date.Format "2006-01-02" }}</span> + </div> + <div class="summary"> + <a href="{{ .RelPermalink }}"> + {{ with .Resources.GetMatch (printf "%s" .Params.thumbnail) }} + <div class="thumbnail"><img src="{{ relURL .Permalink }}" alt="Thumbnail" /></div> + {{ else }} + {{ with .Params.thumbnail }} + <div class="thumbnail"><img src="{{ relURL .}}" alt="Thumbnail" /></div> + {{ else }} + {{ $img := findRE "<img src=\"[^\"]+\"" .Content 1 }} + {{ range $img }} + <div class="thumbnail">{{ (print . " alt=\"Thumbnail\" />") | safeHTML }}</div> + {{ end }} + {{ end }} + {{ end }} + {{ with .Description }} + {{ $.Scratch.Set "summary" (markdownify .) }} + {{ else }} + {{ $.Scratch.Set "summary" ((delimit (findRE "(<p.*?>(.|\n)*?</p>\\s*)+" .Content) "[…] ") | plainify | truncate (default 200 .Site.Params.summary_length) (default " …" .Site.Params.text.truncated ) | replaceRE "&" "&" | safeHTML) }} + {{ end }} + {{ $.Scratch.Get "summary" }} + </a> + </div> +</section> +{{ end }} +</main> +<nav>{{ template "_internal/pagination.html" . }}</nav> +</div> + +{{ partial "footer.html" . }} diff --git a/themes/hugo-xmag/layouts/_default/single.html b/themes/hugo-xmag/layouts/_default/single.html new file mode 100644 index 0000000..173ec3b --- /dev/null +++ b/themes/hugo-xmag/layouts/_default/single.html @@ -0,0 +1,41 @@ +{{ partial "header.html" . }} +<div class="container"> +<article> +<div class="article-meta"> + + <div class="categories"> + {{ range $i, $e := .Params.categories }} + {{ if $i }} ⊹ {{ end }}<a href="{{ relURL (print "/categories/" $e | urlize) }}">{{ $e }}</a> + {{ end }} + </div> + + <h1><span class="title">{{ .Title }}</span></h1> + + {{ if .Params.author }} + <h3 class="author">{{ partial "author_names.html" . }}</h3> + {{ end }} + + {{ with .Params.tags }} + <p>{{ default "Tags: " (index $.Site.Params.text "tags") }}{{ range $i, $e := . }}{{ if $i }}; {{ end }}<a href="{{ relURL (print "/tags/" $e | urlize) }}">{{ $e }}</a>{{ end }} + </p> + {{ end }} + {{ partial "meta.html" . }} + +</div> + +{{ if .Params.toc }} +{{ .TableOfContents }} +{{ end }} + +<main> +{{ .Content }} +</main> + +{{ partial "author.html" . }} +{{ partial "info.html" . }} +{{ partial "prev_next.html" . }} +{{ partial "comments.html" . }} +</article> +</div> + +{{ partial "footer.html" . }} diff --git a/themes/hugo-xmag/layouts/_default/terms.html b/themes/hugo-xmag/layouts/_default/terms.html new file mode 100644 index 0000000..2f432ed --- /dev/null +++ b/themes/hugo-xmag/layouts/_default/terms.html @@ -0,0 +1,22 @@ +{{ partial "header.html" . }} + +<div class="container"> +<article> +<main> +<h1>{{ $.Scratch.Get "Title" }}</h1> + +<ul class="terms"> + {{ range $key, $value := .Data.Terms }} + <li> + <a href="{{ (print "/" $.Data.Plural "/" $key) | relURL }}"> + {{ $key }} + </a> + ({{ len $value }}) + </li> + {{ end }} +</ul> +</main> +</article> +</div> + +{{ partial "footer.html" . }} diff --git a/themes/hugo-xmag/layouts/partials/author.html b/themes/hugo-xmag/layouts/partials/author.html new file mode 100644 index 0000000..c4977ab --- /dev/null +++ b/themes/hugo-xmag/layouts/partials/author.html @@ -0,0 +1,25 @@ +{{ with .Params.author }} +{{ if eq (substr (jsonify .) 0 1) "["}} +{{ $.Scratch.Set "page_author" .}} +{{ else }} +{{ $.Scratch.Set "page_author" (slice .) }} +{{ end }} + +{{ $.Scratch.Set "author_info" slice }} +{{ if $.Site.Data.authors }} +{{ range $.Scratch.Get "page_author" }} +{{ with (index $.Site.Data.authors .) }} +{{ $.Scratch.Add "author_info" . }} +{{ end }} +{{ end }} +{{ end }} +{{ if $.Scratch.Get "author_info" }} +<section class="article-meta article-footer"> + <h3>{{ default "About the Author" $.Site.Params.text.about_author }}</h3> + {{ range $.Scratch.Get "author_info" }} + <p>{{ . | markdownify }}</p> + {{ end }} +</section> +{{ end }} + +{{ end }} diff --git a/themes/hugo-xmag/layouts/partials/author_names.html b/themes/hugo-xmag/layouts/partials/author_names.html new file mode 100644 index 0000000..bbbc978 --- /dev/null +++ b/themes/hugo-xmag/layouts/partials/author_names.html @@ -0,0 +1 @@ +{{ replace ((jsonify .Params.author) | replaceRE "[\\[\"\\]]" "") "," (default ", " $.Site.Params.text.author_delimiter) | safeHTML }} diff --git a/themes/hugo-xmag/layouts/partials/banner.html b/themes/hugo-xmag/layouts/partials/banner.html new file mode 100644 index 0000000..cc4181c --- /dev/null +++ b/themes/hugo-xmag/layouts/partials/banner.html @@ -0,0 +1,7 @@ +<div class="banner"> +<a href="{{ relURL .Site.BaseURL }}"{{ if not .Site.Params.banner }} class="text"{{ end }}> +{{ with .Site.Params.banner }} +<img src="{{ relURL .src }}" alt="{{ .alt }}" /> +{{ else }}{{ (replaceRE "(&[A-Z]) (fr;)" "$1$2" (replaceRE "([A-Z])" "&$1 fr;" (upper .Site.Title))) | safeHTML }} +{{ end }}</a> +</div> diff --git a/themes/hugo-xmag/layouts/partials/comments.html b/themes/hugo-xmag/layouts/partials/comments.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/themes/hugo-xmag/layouts/partials/comments.html diff --git a/themes/hugo-xmag/layouts/partials/foot_custom.html b/themes/hugo-xmag/layouts/partials/foot_custom.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/themes/hugo-xmag/layouts/partials/foot_custom.html diff --git a/themes/hugo-xmag/layouts/partials/footer.html b/themes/hugo-xmag/layouts/partials/footer.html new file mode 100644 index 0000000..6071ad6 --- /dev/null +++ b/themes/hugo-xmag/layouts/partials/footer.html @@ -0,0 +1,34 @@ +<script async src="//yihui.org/js/center-img.js"></script> + +<footer> +{{ partial "foot_custom.html" . }} +<div class="footer"> + <ul class="menu"> + {{ range .Site.Menus.main }} + <li><a href="{{ .URL | relURL }}"><span data-hover="{{ .Name }}">{{ .Name }}</span></a></li> + {{ end }} + </ul> + {{ with .Site.Params.footer }} + <div class="copyright">{{ . | markdownify }}</div> + {{ end }} +</div> +</footer> + +{{ if and (not .Params.disable_mathjax) (or (in (string .Content) "\\") (in (string .Content) "$")) }} +<script src="//yihui.org/js/math-code.js"></script> +<script async src="//mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML"></script> +{{ end }} + +{{ if and (not .Params.disable_highlight) (in (string .Content) "</pre>") }} +<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script> +<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/r.min.js"></script> +<script> +hljs.configure({languages: []}); +hljs.initHighlightingOnLoad(); +</script> +{{ end }} + +{{ template "_internal/google_analytics.html" . }} + +</body> +</html> diff --git a/themes/hugo-xmag/layouts/partials/head_custom.html b/themes/hugo-xmag/layouts/partials/head_custom.html new file mode 100644 index 0000000..960789b --- /dev/null +++ b/themes/hugo-xmag/layouts/partials/head_custom.html @@ -0,0 +1 @@ +<link href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css" rel="stylesheet"> diff --git a/themes/hugo-xmag/layouts/partials/header.html b/themes/hugo-xmag/layouts/partials/header.html new file mode 100644 index 0000000..1d3b190 --- /dev/null +++ b/themes/hugo-xmag/layouts/partials/header.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<html lang="{{ .Site.LanguageCode }}"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + {{ $.Scratch.Set "Title" (default .Title (index .Site.Params.text (print "title_" (lower .Title)))) }} + <title>{{ if eq ($.Scratch.Get "Title") .Site.Title }}{{ .Site.Title }}{{ else }}{{ ($.Scratch.Get "Title") }} | {{ .Site.Title }}{{ end }}</title> + <link rel="stylesheet" href="{{ "css/style.css" | relURL }}" /> + <link rel="stylesheet" href="{{ "css/fonts.css" | relURL }}" /> + {{ partial "head_custom.html" . }} + </head> + + <body{{if .IsPage}} class="page"{{ end }}> + <nav class="header"> + {{ partial "banner.html" . }} + <div class="head-meta"> + {{ if .IsPage }} + <span><a href="{{ relURL .Site.BaseURL }}">{{ (default "Back to Home" .Site.Params.text.back) | safeHTML }}</a></span> + {{ if .Params.date }}<span class="date">{{ .Date.Format "2006-01-02" }}</span>{{ end }} + {{ if .File.Path }} + {{ $RmdFile := (print .File.BaseFileName ".Rmd") }} + {{ if (where (readDir (print "content/" .File.Dir)) "Name" $RmdFile) }} + {{ $.Scratch.Set "FilePath" (print .File.Dir $RmdFile) }} + {{ else }} + {{ $.Scratch.Set "FilePath" .File.Path }} + {{ end }} + {{ $.Scratch.Set "FilePath" (replace ($.Scratch.Get "FilePath") "\\" "/") }} + {{ with .Site.Params.github_edit}} + <span><a href="{{ . }}{{ $.Scratch.Get "FilePath" }}">{{ (default "Edit this page" $.Site.Params.text.edit) | safeHTML }}</a></span> + {{ end }} + {{ end }} + {{ else }} + <span>{{ $.Scratch.Get "Title" }}</span> + <span>{{ .Site.Params.text.last_update }}{{ now.Format "2006-01-02" }}</span> + {{ $pages := .Pages }} + {{ if .IsHome }}{{ $pages = .Site.RegularPages }}{{ end }} + {{ $paginator := .Paginate (where $pages "Section" "!=" "") }} + <span>{{ with $paginator }}{{ if .TotalPages }}{{ .PageNumber }} / {{ .TotalPages }}{{ end }}{{ end }}</span> + {{ end }} + </div> + </nav> diff --git a/themes/hugo-xmag/layouts/partials/info.html b/themes/hugo-xmag/layouts/partials/info.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/themes/hugo-xmag/layouts/partials/info.html diff --git a/themes/hugo-xmag/layouts/partials/meta.html b/themes/hugo-xmag/layouts/partials/meta.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/themes/hugo-xmag/layouts/partials/meta.html diff --git a/themes/hugo-xmag/layouts/partials/prev_next.html b/themes/hugo-xmag/layouts/partials/prev_next.html new file mode 100644 index 0000000..b2ec685 --- /dev/null +++ b/themes/hugo-xmag/layouts/partials/prev_next.html @@ -0,0 +1,6 @@ +{{ if .Section }} +<nav class="post-nav"> + <span class="nav-prev">{{ with .NextInSection }}<a href="{{ .RelPermalink }}">← {{ .Title }}</a>{{ end }}</span> + <span class="nav-next">{{ with .PrevInSection }}<a href="{{ .RelPermalink }}">{{ .Title }} →</a>{{ end }}</span> +</nav> +{{ end }} |
