diff options
author | 7ma7X <hellorusk1998@gmail.com> | 2020-06-01 11:39:47 +0300 |
---|---|---|
committer | 7ma7X <hellorusk1998@gmail.com> | 2020-06-01 11:39:47 +0300 |
commit | 75c97e730a5931426848997f6163c6555cd50ae2 (patch) | |
tree | f99bf0fc68637ae05fdb4aec64fa41a6a52633e5 /layouts |
initial commit
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/baseof.html | 11 | ||||
-rw-r--r-- | layouts/_default/list.html | 29 | ||||
-rw-r--r-- | layouts/_default/single.html | 25 | ||||
-rw-r--r-- | layouts/_default/terms.html | 16 | ||||
-rw-r--r-- | layouts/partials/footer.html | 12 | ||||
-rw-r--r-- | layouts/partials/head.html | 14 | ||||
-rw-r--r-- | layouts/partials/header.html | 42 | ||||
-rw-r--r-- | layouts/partials/nav.html | 22 | ||||
-rw-r--r-- | layouts/partials/postmeta.html | 9 | ||||
-rw-r--r-- | layouts/partials/preview.html | 14 | ||||
-rw-r--r-- | layouts/partials/toc.html | 18 |
11 files changed, 212 insertions, 0 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..abd1ee2 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html lang="{{ .Site.LanguageCode }}"> + {{- partial "head.html" . -}} + <body> + {{- partial "header.html" . -}} + <div id="content"> + {{- block "main" . }}{{- end }} + </div> + {{- partial "footer.html" . -}} + </body> +</html> diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..97ac744 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,29 @@ +{{ define "main" }} +<div class="container" role="main"> + <div class="posts-list"> + {{ if .IsHome }} + {{ $pag := .Paginate (where site.RegularPages "Type" "in" site.Params.mainSections) }} + {{ else }} + {{ $pag := .Paginator.Pages }} + {{ end }} + + {{ range .Paginator.Pages }} + {{ partial "preview.html" . }} + {{ end }} + </div> + {{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }} + <ul class="pager"> + {{ if .Paginator.HasPrev }} + <li class="previous"> + <a href="{{ .Permalink }}page/{{ .Paginator.Prev.PageNumber }}/">← Newer</a> + </li> + {{ end }} + {{ if .Paginator.HasNext }} + <li class="next"> + <a href="{{ .Permalink }}page/{{ .Paginator.Next.PageNumber }}/">Older →</a> + </li> + {{ end }} + </ul> + {{ end }} +</div> +{{ end }}
\ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..9997b19 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,25 @@ +{{ define "main" }} + <div class="container" role="main"> + <article class="article" class="blog-post"> + <div class="postmeta"> + {{ partial "postmeta.html" . }} + </div> + <br> + {{ partial "toc.html" . }} + + {{ if .Params.tags }} + <div class="blog-tags"> + {{ range .Params.tags }} + <a href="{{ $.Site.BaseURL }}/tags/{{ . | urlize }}/">{{ . }}</a> + {{ end }} + </div> + {{ end }} + </article> + {{ if and (gt .WordCount 400) (.Param "backtotop") }} + {{ partial "backtotop.html" . }} + <button onclick="topFunction()" id="backtotopButton"> + <i class="fa fa-angle-up"></i> + </button> + {{ end }} + </div> +{{ end }}
\ No newline at end of file diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html new file mode 100644 index 0000000..86b9e27 --- /dev/null +++ b/layouts/_default/terms.html @@ -0,0 +1,16 @@ +{{ define "main" }} + +<div class="container" role="main"> + <article class="post-preview"> + {{ range .Data.Terms.Alphabetical }} + <div class="terms"> + <h4 class="term-name" > + <a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> + <span class="badge">{{ .Count }}</span> + </h4> + </div> + {{ end }} + </article> +</div> + +{{ end }}
\ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..5ccbfa1 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1,12 @@ +<footer> + <div class="container"> + <p class="credits copyright"> + <p class="credits theme-by"> + Powered By <a href="https://gohugo.io">Hugo</a> / Theme <a href="https://github.com/7ma7X/HugoTeX">HugoTeX</a> + <br> + <a href="{{ .Site.BaseURL }}about">{{ .Site.Author.name }}</a> + © + {{ .Site.LastChange.Format "2006" }} + </p> + </div> +</footer>
\ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 0000000..b67c244 --- /dev/null +++ b/layouts/partials/head.html @@ -0,0 +1,14 @@ +<meta charset="utf-8" /> +<title>{{ .Title }}</title> +{{ with .Site.Params.description }} + <meta name="description" content="{{ . }}" /> +{{ end }} +{{- with .Site.Author.Name }} + <meta name="author" content="{{ . }}"/> +{{- end }} +<meta http-equiv="X-UA-Compatible" content="IE=edge" /> +<meta name="viewport" content="width=device-width, initial-scale=1.0" /> +<link rel="stylesheet" href="{{ .Site.BaseURL }}css/latex.css" /> +<link rel="stylesheet" href="{{ .Site.BaseURL }}css/main.css" /> +<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script> +{{ hugo.Generator -}}
\ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..61ed785 --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,42 @@ + +{{ if .IsHome }} +{{ if .Site.Params.homeTitle }} + {{ $.Scratch.Set "title" .Site.Params.homeTitle }} +{{ else }} + {{ $.Scratch.Set "title" .Site.Title }} +{{ end }} +{{ else }} +{{ $.Scratch.Set "title" .Title }} +{{ end }} + +{{ $title := $.Scratch.Get "title" }} +{{ if $title }} +<header> + {{ partial "nav.html" . }} + <div class="intro-header"> + <div class="container"> + <div class="{{ .Type }}-heading"> + {{ if eq .Type "list" }} + <h1>{{ if .Data.Singular }}#{{ end }}{{ .Title }}</h1> + {{ else }} + <h1>{{ with $title }}{{.}}{{ else }}<br/>{{ end }}</h1> + {{ if .IsHome }} + <p class="author">{{ with .Site.Author.name }}{{.}}{{ else }}<br/>{{ end }}</p> + + {{ if .Site.Author.abstract }} + <div class="abstract"> + <h5>Abstract</h5> + <p> + {{ .Site.Author.abstract }} + </p> + </div> + {{ end }} + {{ end }} + {{ end }} + </div> + </div> + </div> +</header> +{{ else }} +<div class="intro-header"></div> +{{ end }}
\ No newline at end of file diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html new file mode 100644 index 0000000..7a88907 --- /dev/null +++ b/layouts/partials/nav.html @@ -0,0 +1,22 @@ +<nav class="navbar"> + <div class="nav"> + {{ if .Site.Params.logo }} + <a href="{{ .Site.BaseURL }}" class="nav-logo"> + <img src="{{ .Site.BaseURL }}images/{{ .Site.Params.logo.url }}" + width="{{ .Site.Params.logo.width }}" + height="{{ .Site.Params.logo.height }}" + alt="{{ .Site.Params.logo.alt }}"> + </a> + {{ end }} + + <ul class="nav-links"> + {{ range .Site.Params.nav }} + {{ if .icon }} + <li><a href="{{ .url | relLangURL }}" name="{{ .name }}"><i class="{{ .icon }}"></i></a></li> + {{ else }} + <li><a href="{{ .url | relLangURL }}" name="{{ .name }}">{{ .name }}</a></li> + {{ end }} + {{ end }} + </ul> + </div> +</nav>
\ No newline at end of file diff --git a/layouts/partials/postmeta.html b/layouts/partials/postmeta.html new file mode 100644 index 0000000..bdf53cc --- /dev/null +++ b/layouts/partials/postmeta.html @@ -0,0 +1,9 @@ +<span class="meta-post"> + <i class="fa fa-calendar-alt"></i>{{ .Lastmod.Format ( .Site.Params.dateformat | default "Jan 2, 2006") }} + {{ if .Params.categories }} + <br><i class="fa fa-folder-open"></i> + {{ range .Params.categories }} + <a href="{{ $.Site.BaseURL }}/categories/{{ . | urlize }}/">{{ . }}</a> + {{ end }} + {{ end }} +</span>
\ No newline at end of file diff --git a/layouts/partials/preview.html b/layouts/partials/preview.html new file mode 100644 index 0000000..65a80ac --- /dev/null +++ b/layouts/partials/preview.html @@ -0,0 +1,14 @@ +<article class="post-preview"> + <a href="{{ .Permalink }}"> + <h2 class="post-title">{{ .Title }}</h2> + </a> + <div class="postmeta"> + {{ partial "postmeta.html" . }} + </div> + <div class="post-entry"> + {{ if .Truncated }} + <p>{{ .Summary }}</p> + <a href="{{ .Permalink }}" class="post-read-more">Read More</a> + {{ end }} + </div> +</article>
\ No newline at end of file diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html new file mode 100644 index 0000000..8d459e3 --- /dev/null +++ b/layouts/partials/toc.html @@ -0,0 +1,18 @@ +{{ if and (gt .WordCount 400) (.Param "toc") }} + {{- /* 正規表現でh[1-6]を探す */ -}} + {{- $header := (findRE "<h2.*?>(?:.|\n)*?</h2>" .Content) -}} + {{- /* 最初に出現するh[1-6]を取得 */ -}} + {{- $firstH := index $header 0 -}} + + {{- if ne $firstH nil -}} + {{- /* ヘッダーの前にToCを結合した「新しいヘッダー」を作成 */ -}} + {{- $newH := printf `%s%s` .TableOfContents $firstH -}} + {{- /* 古いヘッダーを新しいヘッダーに置換して出力 */ -}} + {{- replace .Content $firstH $newH | safeHTML -}} + {{- else -}} + {{- /* そもそもヘッダーがない時は普通に出力 */ -}} + {{- .Content -}} + {{- end -}} +{{ else }} + {{ .Content }} +{{ end }}
\ No newline at end of file |