diff options
author | Yihui Xie <xie@yihui.name> | 2017-07-10 07:29:36 +0300 |
---|---|---|
committer | Yihui Xie <xie@yihui.name> | 2017-07-10 08:09:53 +0300 |
commit | 1659c35fc60111245cae1e42e09cd32dd50c6d9a (patch) | |
tree | b27fd0b28aaae85a2f4e0998704ad9137bc4891a /layouts | |
parent | f30f589916a97964e2238f2550d22648eb9b3fa5 (diff) |
massive tweaks of the hugo-xmin theme and the new them hugo-xmag is basically complete now
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/list.html | 45 | ||||
-rw-r--r-- | layouts/_default/single.html | 51 | ||||
-rw-r--r-- | layouts/_default/terms.html | 4 | ||||
-rw-r--r-- | layouts/partials/comments.html | 0 | ||||
-rw-r--r-- | layouts/partials/footer.html | 45 | ||||
-rw-r--r-- | layouts/partials/head_custom.html | 2 | ||||
-rw-r--r-- | layouts/partials/header.html | 32 | ||||
-rw-r--r-- | layouts/partials/info.html | 0 |
8 files changed, 151 insertions, 28 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 41d9d89..8b214af 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,18 +1,37 @@ {{ partial "header.html" . }} -{{if not .IsHome }} -<h1>{{ .Title }}</h1> -{{ end }} - -{{ .Content }} - -<ul> - {{ range (where .Data.Pages "Section" "!=" "") }} - <li> - <span class="date">{{ .Date.Format "2006/01/02" }}</span> - <a href="{{ .URL }}">{{ .Title }}</a> - </li> +<div class="container"> +<main class="list"> +{{ range (where .Paginator.Pages "Section" "post") }} +<section class="article-list"> + {{ with .Params.categories }} + {{ range first 1 . }} + <div class="categories"> + <a href="{{ relURL (print "/categories/" . | urlize) }}">{{ . }}</a> + </div> {{ end }} -</ul> + {{ end }} + <h1><a href="{{ .URL }}">{{ .Title }}</a></h1> + <div> + <span>{{ .Date.Format "2006/01/02" }}</span> + {{ with .Params.author }}<span>{{ . }}</span>{{ end }} + </div> + <div class="summary"> + {{ 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 }} + {{ (default .Summary (.Description | markdownify | plainify)) | truncate (default 200 .Site.Params.summary_length) }} + <a href="{{ .URL }}" class="more">{{ (default "Read more →" .Site.Params.text.more) | safeHTML }}</a> + </div> +</section> +{{ end }} +</main> +<nav>{{ template "_internal/pagination.html" . }}</nav> +</div> {{ partial "footer.html" . }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 3dfda29..1b159f0 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,12 +1,57 @@ {{ partial "header.html" . }} +<div class="container"> +<article> <div class="article-meta"> -<h1><span class="title">{{ .Title }}</span></h1> -{{ with .Params.author }}<h2 class="author">{{ . }}</h2>{{ end }} -{{ if .Params.date }}<h2 class="date">{{ .Date.Format "2006/01/02" }}</h2>{{ end }} + + <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> + + {{ with .Params.author }} + <h3 class="author">{{ . }}</h3> + {{ end }} + + {{ with .Params.tags }} + <div>{{ default "Tags: " (index $.Site.Params.text "tags") }} {{ range $i, $e := . }}{{ if $i }}; {{ end }}<a href="{{ relURL (print "/tags/" $e | urlize) }}">{{ $e }}</a>{{ end }} + </div> + {{ end }} + </div> +{{ if .Params.toc }} +{{ .TableOfContents }} +{{ end }} + <main> {{ .Content }} </main> +{{ with .Params.author }} +{{ if $.Site.Data.authors }} +{{ with (index $.Site.Data.authors .) }} +<section class="article-meta article-footer"> + <h3>{{ default "About the Author" $.Site.Params.text.about_author }}</h3> + <p>{{ . | markdownify }}</p> +</section> +{{ end }} +{{ end }} +{{ end }} + +{{ partial "info.html" . }} + +{{ 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 }} + +{{ partial "comments.html" . }} +</article> +</div> + {{ partial "footer.html" . }} diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html index b21e866..beabff8 100644 --- a/layouts/_default/terms.html +++ b/layouts/_default/terms.html @@ -1,5 +1,7 @@ {{ partial "header.html" . }} +<div class="container"> +<main> <h1>{{ .Title }}</h1> <ul class="terms"> @@ -12,5 +14,7 @@ </li> {{ end }} </ul> +</main> +</div> {{ partial "footer.html" . }} diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/layouts/partials/comments.html diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 3f46ea5..d636239 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,9 +1,42 @@ - <footer> - {{ partial "foot_custom.html" . }} +<script async src="//yihui.name/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 }}">{{ .Name }}</a></li> + {{ end }} + </ul> {{ with .Site.Params.footer }} - <hr/> - {{ . | markdownify }} + <div class="copyright">{{ . | markdownify }}</div> {{ end }} - </footer> - </body> +</div> +</footer> + +{{ if and (not .Params.disable_mathjax) (or (in (string .Content) "\\") (in (string .Content) "$")) }} +<script src="//yihui.name/js/math-code.js"></script> +<script type="text/x-mathjax-config"> +MathJax.Hub.Config({ + tex2jax: { + inlineMath: [['$','$'], ['\\(','\\)']], + processEscapes: true + } +}); +</script> +<script async src="//cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML"></script> +{{ end }} + +{{ if and (not .Params.disable_highlight) (in (string .Content) "</pre>") }} +<script src="//cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js"></script> +<script src="//cdn.bootcss.com/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/layouts/partials/head_custom.html b/layouts/partials/head_custom.html index e69de29..590375b 100644 --- a/layouts/partials/head_custom.html +++ b/layouts/partials/head_custom.html @@ -0,0 +1,2 @@ +<link href="//cdn.bootcss.com/highlight.js/9.12.0/styles/github.min.css" rel="stylesheet"> +<style>pre { background: #f8f8f8; }</style> diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 6f291e2..8bc4482 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -9,11 +9,31 @@ </head> <body> - <nav> - <ul class="menu"> - {{ range .Site.Menus.main }} - <li><a href="{{ .URL | relURL }}">{{ .Name }}</a></li> + <nav class="header"> + <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> + <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 }} + {{ 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>{{ .Title }}</span> + <span>{{ now.Format "2006/01/02" }}</span> + {{ with .Paginator }}<span>{{ .PageNumber }} / {{ .TotalPages }}</span>{{ end }} {{ end }} - </ul> - <hr/> + </div> </nav> diff --git a/layouts/partials/info.html b/layouts/partials/info.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/layouts/partials/info.html |