diff options
Diffstat (limited to 'themes/even/layouts')
26 files changed, 920 insertions, 0 deletions
diff --git a/themes/even/layouts/404.html b/themes/even/layouts/404.html new file mode 100644 index 0000000..fcf2b37 --- /dev/null +++ b/themes/even/layouts/404.html @@ -0,0 +1,18 @@ +{{ define "title" }}404 page not found - {{ .Site.Title }}{{ end }} + +{{ define "content" }} +<div class="not-found"> + <h1 class="error-emoji"></h1> + <p class="error-text">/* 404 page not found. */</p> + <p class="error-link"><a href="{{ "/" | relLangURL }}">↑ Back Home ↑</a></p> +</div> +<script> + var errorEmojiContainer = document.getElementsByClassName('error-emoji')[0]; + var emojiArray = [ + '\\(o_o)/', '(o^^)o', '(˚Δ˚)b', '(^-^*)', '(≥o≤)', '(^_^)b', '(·_·)', + '(=\'X\'=)', '(>_<)', '(;-;)', '\\(^Д^)/', + ]; + var errorEmoji = emojiArray[Math.floor(Math.random() * emojiArray.length)]; + errorEmojiContainer.appendChild(document.createTextNode(errorEmoji)); +</script> +{{ end }} diff --git a/themes/even/layouts/_default/baseof.html b/themes/even/layouts/_default/baseof.html new file mode 100644 index 0000000..0693148 --- /dev/null +++ b/themes/even/layouts/_default/baseof.html @@ -0,0 +1,46 @@ +{{ if ne .Site.Params.version "3.x" -}} +{{ errorf "\n\nThere are two possible situations that led to this error:\n 1. You haven't copied the config.toml yet. See https://github.com/olOwOlo/hugo-theme-even#installation \n 2. You have an incompatible update. See https://github.com/olOwOlo/hugo-theme-even/blob/master/CHANGELOG.md#300 \n\n有两种可能的情况会导致这个错误发生:\n 1. 你还没有复制 config.toml 参考 https://github.com/olOwOlo/hugo-theme-even/blob/master/README-zh.md#installation \n 2. 你进行了一次不兼容的更新 参考 https://github.com/olOwOlo/hugo-theme-even/blob/master/CHANGELOG.md#300 \n" -}} +{{ end -}} +<!DOCTYPE html> +<html lang="{{ .Site.Language }}"> +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + <title> + {{- block "title" . -}} + {{ if .IsPage }}{{ .Title }} - {{ .Site.Title }}{{ else }}{{ .Site.Title }}{{ end }} + {{- end -}} + </title> + {{ partial "head.html" . }} +</head> +<body> + {{ partial "slideout.html" . }} + <div class="container" id="mobile-panel"> + {{ if not .Params.hideHeaderAndFooter -}} + <header id="header" class="header"> + {{ partial "header.html" . }} + </header> + {{- end }} + + <main id="main" class="main"> + <div class="content-wrapper"> + <div id="content" class="content"> + {{ block "content" . }}{{ end }} + </div> + {{ partial "comments.html" . }} + </div> + </main> + + {{ if not .Params.hideHeaderAndFooter -}} + <footer id="footer" class="footer"> + {{ partial "footer.html" . }} + </footer> + {{- end }} + + <div class="back-to-top" id="back-to-top"> + <i class="iconfont icon-up"></i> + </div> + </div> + {{ partial "scripts.html" . }} +</body> +</html> diff --git a/themes/even/layouts/_default/section.html b/themes/even/layouts/_default/section.html new file mode 100644 index 0000000..fbe80f1 --- /dev/null +++ b/themes/even/layouts/_default/section.html @@ -0,0 +1,50 @@ +{{ define "title" }}{{ T "archive" }} - {{ .Site.Title }}{{ end }} + +{{ define "content"}} +{{- $paginator := .Paginate .Data.Pages.ByDate.Reverse .Site.Params.archivePaginate }} +<section id="archive" class="archive"> + {{- if and (not $paginator.HasPrev) .Site.Params.showArchiveCount }} + <div class="archive-title"> + <span class="archive-post-counter"> + {{ T "archiveCounter" (len .Data.Pages) }} + </span> + </div> + {{- end -}} + + {{- range $index, $element := $paginator.Pages -}} + {{- $thisYear := $element.Date.Format "2006" }} + {{- $lastElement := $index | add -1 | index $paginator.Pages }} + {{ if or (eq $index 0) ( ne ($lastElement.Date.Format "2006") $thisYear ) }} + <div class="collection-title"> + <h2 class="archive-year">{{ $thisYear }}</h2> + </div> + {{- end }} + + <div class="archive-post"> + <span class="archive-post-time"> + {{ $element.Date.Format "01-02" }} + </span> + <span class="archive-post-title"> + <a href="{{ $element.URL }}" class="archive-post-link"> + {{ .Title }} + </a> + </span> + </div> + {{- end -}} +</section> +<!-- pagination --> +<nav class="pagination"> + {{ with $paginator.Prev -}} + <a class="prev" href="{{ .URL }}"> + <i class="iconfont icon-left"></i> + <span class="prev-text">{{ T "prevPage" }}</span> + </a> + {{- end }} + {{ with $paginator.Next -}} + <a class="next" href="{{ .URL }}"> + <span class="next-text">{{ T "nextPage" }}</span> + <i class="iconfont icon-right"></i> + </a> + {{- end }} +</nav> +{{ end }} diff --git a/themes/even/layouts/_default/single.html b/themes/even/layouts/_default/single.html new file mode 100644 index 0000000..a1c30fd --- /dev/null +++ b/themes/even/layouts/_default/single.html @@ -0,0 +1,7 @@ +{{ define "content" -}} +<article class="post"> + <div class="post-content"> + {{ .Content }} + </div> +</article> +{{- end }}
\ No newline at end of file diff --git a/themes/even/layouts/_default/single.md b/themes/even/layouts/_default/single.md new file mode 100644 index 0000000..57705e2 --- /dev/null +++ b/themes/even/layouts/_default/single.md @@ -0,0 +1 @@ +{{ .RawContent }}
\ No newline at end of file diff --git a/themes/even/layouts/_default/taxonomy.html b/themes/even/layouts/_default/taxonomy.html new file mode 100644 index 0000000..d0c8d43 --- /dev/null +++ b/themes/even/layouts/_default/taxonomy.html @@ -0,0 +1,46 @@ +{{ define "title" }}{{ .Title }} · {{ .Site.Title }}{{ end }} + +{{ define "content"}} +{{ $paginator := .Paginate .Data.Pages.ByDate.Reverse .Site.Params.archivePaginate }} +<section id="archive" class="archive"> + {{ if not $paginator.HasPrev }} + {{ if eq .Data.Plural "tags" }} + <div class="archive-title tag"> + <h2 class="archive-name">{{ .Title }}</h2> + </div> + {{ else if eq .Data.Plural "categories" }} + <div class="archive-title category"> + <h2 class="archive-name">{{ .Title }}</h2> + </div> + {{ end }} + {{ end }} + + {{ range $paginator.Pages }} + <div class="archive-post"> + <span class="archive-post-time"> + {{ .Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} + </span> + <span class="archive-post-title"> + <a href="{{ .URL }}" class="archive-post-link"> + {{ .Title }} + </a> + </span> + </div> + {{ end }} +</section> +<!-- pagination --> +<nav class="pagination"> + {{ with $paginator.Prev }} + <a class="prev" href="{{ .URL }}"> + <i class="iconfont icon-left"></i> + <span class="prev-text">{{ T "prevPage" }}</span> + </a> + {{- end }} + {{ with $paginator.Next }} + <a class="next" href="{{ .URL }}"> + <span class="next-text">{{ T "nextPage" }}</span> + <i class="iconfont icon-right"></i> + </a> + {{- end }} +</nav> +{{ end }} diff --git a/themes/even/layouts/_default/terms.html b/themes/even/layouts/_default/terms.html new file mode 100644 index 0000000..04b98f8 --- /dev/null +++ b/themes/even/layouts/_default/terms.html @@ -0,0 +1,44 @@ +{{ define "title" }}{{ T .Data.Plural }} - {{ .Site.Title }}{{ end }} + +{{ define "content" }} + {{ $name := .Data.Plural -}} + {{ $terms := .Data.Terms.ByCount -}} + {{ $length := len $terms -}} + {{ if eq $name "categories" }} + <div class="categories"> + <div class="categories-title"> + {{ if eq $length 0 }} + {{ T "zeroCategoryCounter" }} + {{ else }} + {{ T "categoryCounter" $length }} + {{ end }} + </div> + <div class="categories-tags"> + {{ range $key, $value := $terms }} + <a class="category-link" href="{{ $name | relLangURL }}/{{ $value.Term | urlize }}/"> + {{ $value.Term }} + <span class="category-count">{{ len $value.Pages }}</span> + </a> + {{ end }} + </div> + </div> + {{ else if eq $name "tags" }} + <div class="tag-cloud"> + <div class="tag-cloud-title"> + {{ if eq $length 0 }} + {{ T "zeroTagCounter" }} + {{ else }} + {{ T "tagCounter" $length }} + {{ end }} + </div> + <div class="tag-cloud-tags"> + {{ range $key, $value := $terms }} + <a href="{{ $name | relLangURL }}/{{ $value.Term | urlize }}/"> + {{ $value.Term }} + <span class="tag-count">{{ len $value.Pages }}</span> + </a> + {{ end }} + </div> + </div> + {{ end }} +{{ end }}
\ No newline at end of file diff --git a/themes/even/layouts/index.html b/themes/even/layouts/index.html new file mode 100644 index 0000000..26d6869 --- /dev/null +++ b/themes/even/layouts/index.html @@ -0,0 +1,24 @@ +{{ define "content" }} + <section id="posts" class="posts"> + {{/* (index .Site.Paginate) */}} + {{ $paginator := .Paginate (where (where .Data.Pages "Type" "post") ".Params.hiddenfromhomepage" "!=" true) }} + {{ range $paginator.Pages }} + {{ .Render "summary" }} + {{ end }} + </section> + <!-- pagination --> + <nav class="pagination"> + {{ with $paginator.Prev }} + <a class="prev" href="{{ .URL }}"> + <i class="iconfont icon-left"></i> + <span class="prev-text">{{ T "prevPage" }}</span> + </a> + {{- end }} + {{ with $paginator.Next }} + <a class="next" href="{{ .URL }}"> + <span class="next-text">{{ T "nextPage" }}</span> + <i class="iconfont icon-right"></i> + </a> + {{- end }} + </nav> +{{ end }}
\ No newline at end of file diff --git a/themes/even/layouts/partials/comments.html b/themes/even/layouts/partials/comments.html new file mode 100644 index 0000000..440240a --- /dev/null +++ b/themes/even/layouts/partials/comments.html @@ -0,0 +1,109 @@ +{{ if and .IsPage (ne .Params.comment false) }} + <!-- Disqus --> + {{- if .Site.DisqusShortname -}} + <div id="disqus_thread"></div> + <script type="text/javascript"> + (function() { + // Don't ever inject Disqus on localhost--it creates unwanted + // discussions from 'localhost:1313' on your Disqus account... + if (window.location.hostname === 'localhost') return; + + var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; + var disqus_shortname = '{{ .Site.DisqusShortname }}'; + dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; + (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); + })(); + </script> + <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> + {{- end -}} + + <!-- changyan --> + {{- if and .Site.Params.changyanAppid .Site.Params.changyanAppkey -}} + <div id="SOHUCS"></div> + <script type="text/javascript"> + (function(){ + if (window.location.hostname === 'localhost') return; + + var appid = '{{ .Site.Params.changyanAppid }}'; + var conf = '{{ .Site.Params.changyanAppkey }}'; + var width = window.innerWidth || document.documentElement.clientWidth; + if (width < 960) {window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){window.changyan.api.config({appid:appid,conf:conf})}); } + })(); + </script> + {{- end -}} + + <!-- LiveRe --> + {{- if .Site.Params.livereUID -}} + <div id="lv-container" data-id="city" data-uid="{{ .Site.Params.livereUID }}"> + <script type="text/javascript"> + (function(d, s) { + var j, e = d.getElementsByTagName(s)[0]; + + if (typeof LivereTower === 'function') { return; } + + j = d.createElement(s); + j.src = 'https://cdn-city.livere.com/js/embed.dist.js'; + j.async = true; + + e.parentNode.insertBefore(j, e); + })(document, 'script'); + </script> + <noscript>Please enable JavaScript to view the comments powered by <a href="https://livere.com/">LiveRe.</a></noscript> + </div> + {{- end -}} + + <!-- gitment --> + {{- if .Site.Params.gitment.owner -}} + <div id="comments-gitment"></div> + {{ if .Site.Params.publicCDN.enable -}} + {{ .Site.Params.publicCDN.gitmentCSS | safeHTML }} + {{ .Site.Params.publicCDN.gitmentJS | safeHTML }} + {{- else -}} + <link rel="stylesheet" href="{{ "lib/gitment/gitment-0.0.3.min.css" | relURL }}"> + <script src="{{ "lib/gitment/gitment-0.0.3.min.js" | relURL }}"></script> + {{- end }} + <script type="text/javascript"> + const gitment = new Gitment({ + id: '{{ .Date }}', + title: '{{ .Title }}', + link: decodeURI(location.href), + desc: '{{ .Summary }}', + owner: '{{ .Site.Params.gitment.owner }}', + repo: '{{ .Site.Params.gitment.repo }}', + oauth: { + client_id: '{{ .Site.Params.gitment.clientId }}', + client_secret: '{{ .Site.Params.gitment.clientSecret }}' + } + }) + gitment.render('comments-gitment') + </script> + <noscript>Please enable JavaScript to view the <a href="https://github.com/imsun/gitment">comments powered by gitment.</a></noscript> + {{- end }} + + <!-- gitalk --> + {{- if .Site.Params.gitalk.owner -}} + <div id="gitalk-container"></div> + {{ if .Site.Params.publicCDN.enable -}} + {{ .Site.Params.publicCDN.gitalkCSS | safeHTML }} + {{ .Site.Params.publicCDN.gitalkJS | safeHTML }} + {{- else -}} + <link rel="stylesheet" href="{{ "lib/gitalk/gitalk-1.2.2.min.css" | relURL }}"> + <script src="{{ "lib/gitalk/gitalk-1.2.2.min.js" | relURL }}"></script> + {{- end }} + <script type="text/javascript"> + var gitalk = new Gitalk({ + id: '{{ .Date }}', + title: '{{ .Title }}', + clientID: '{{ .Site.Params.gitalk.clientId }}', + clientSecret: '{{ .Site.Params.gitalk.clientSecret }}', + repo: '{{ .Site.Params.gitalk.repo }}', + owner: '{{ .Site.Params.gitalk.owner }}', + admin: ['{{ .Site.Params.gitalk.owner }}'], + body: decodeURI(location.href) + }); + gitalk.render('gitalk-container'); + </script> + <noscript>Please enable JavaScript to view the <a href="https://github.com/gitalk/gitalk">comments powered by gitalk.</a></noscript> + {{- end }} + +{{- end }} diff --git a/themes/even/layouts/partials/footer.html b/themes/even/layouts/partials/footer.html new file mode 100644 index 0000000..b6a1fa5 --- /dev/null +++ b/themes/even/layouts/partials/footer.html @@ -0,0 +1,52 @@ +<div class="social-links"> + {{- range $name, $path := .Site.Params.social }} + {{- if $path }} + {{- $realName := slicestr $name 2 }} + <a href="{{ $path | safeURL }}" class="iconfont icon-{{ $realName }}" title="{{ $realName }}"></a> + {{- end }} + {{- end }} + {{ if .Site.LanguagePrefix -}} + <a href="{{ .Site.LanguagePrefix | absURL }}/index.xml" type="application/rss+xml" class="iconfont icon-rss" title="rss"></a> + {{- else -}} + <a href="{{ .Site.RSSLink }}" type="application/rss+xml" class="iconfont icon-rss" title="rss"></a> + {{- end }} +</div> + +<div class="copyright"> + <span class="power-by"> + {{ (printf (T "powered") `<a class="hexo-link" href="https://gohugo.io">Hugo</a>`) | safeHTML }} + </span> + <span class="division">|</span> + <span class="theme-info"> + {{ T "theme" }} - + <a class="theme-link" href="https://github.com/olOwOlo/hugo-theme-even">Even</a> + </span> + + {{ if .Site.Params.busuanzi.enable -}} + <div class="busuanzi-footer"> + {{ $spinner := "img/spinner.svg" | relURL -}} + {{ if and .Site.Params.busuanzi.enable .Site.Params.busuanzi.sitePV -}} + {{ $valueSpan := printf `<span id="busuanzi_value_site_pv"><img src="%s" alt="spinner.svg"/></span>` $spinner -}} + <span id="busuanzi_container_site_pv"> {{ printf (T "sitePV") $valueSpan | safeHTML }} </span> + {{ if .Site.Params.busuanzi.siteUV }}<span class="division">|</span>{{ end }} + {{- end }} + {{ if and .Site.Params.busuanzi.enable .Site.Params.busuanzi.siteUV -}} + {{ $valueSpan := printf `<span id="busuanzi_value_site_uv"><img src="%s" alt="spinner.svg"/></span>` $spinner -}} + <span id="busuanzi_container_site_uv"> {{ printf (T "siteUV") $valueSpan | safeHTML }} </span> + {{- end }} + </div> + {{- end }} + + <span class="copyright-year"> + {{- $current := now.Format "2006" }} + © + {{ if ne .Site.Params.since $current }} + {{ .Site.Params.since }} - + {{ end }} + {{- $current }} + <span class="heart"> + <i class="iconfont icon-heart"></i> + </span> + <span class="author">{{if .Site.Copyright }}{{ .Site.Copyright | safeHTML }}{{ else }}{{ .Site.Author.name | safeHTML }}{{ end }}</span> + </span> +</div>
\ No newline at end of file diff --git a/themes/even/layouts/partials/head.html b/themes/even/layouts/partials/head.html new file mode 100644 index 0000000..86ab6cf --- /dev/null +++ b/themes/even/layouts/partials/head.html @@ -0,0 +1,90 @@ +<meta name="renderer" content="webkit" /> +<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> + +<meta http-equiv="Cache-Control" content="no-transform" /> +<meta http-equiv="Cache-Control" content="no-siteapp" /> + +<meta name="theme-color" content="#f8f5ec" /> +<meta name="msapplication-navbutton-color" content="#f8f5ec"> +<meta name="apple-mobile-web-app-capable" content="yes"> +<meta name="apple-mobile-web-app-status-bar-style" content="#f8f5ec"> + +<!-- author & description & keywords --> +<meta name="author" content="{{ if .Params.author }}{{ .Params.author | safeHTML }}{{ else }}{{ .Site.Author.name | safeHTML }}{{ end }}" /> + +{{- if .Description -}} + <meta name="description" content="{{ .Description | safeHTML }}" /> +{{ else if .IsPage }} + <meta name="description" content="{{ .Summary | plainify }}" /> +{{ else if .Site.Params.description }} + <meta name="description" content="{{ .Site.Params.description | safeHTML }}" /> +{{- end -}} + +{{- if .Keywords -}} + {{ $length := len .Keywords | add -1 -}} + <meta name="keywords" content="{{ range $index, $element := .Keywords }}{{ $element | safeHTML }}{{if ne $index $length }}, {{ end }}{{ end }}" /> +{{ else if .Site.Params.keywords }} + {{ $length := len .Site.Params.keywords | add -1 -}} + <meta name="keywords" content="{{ range $index, $element := .Site.Params.keywords }}{{ $element | safeHTML }}{{if ne $index $length }}, {{ end }}{{ end }}" /> +{{- end }} + +<!-- baidu & google verification --> +{{ with .Site.Params.baidu_verification }}<meta name="baidu-site-verification" content="{{.}}" />{{ end }} +{{ with .Site.Params.google_verification }}<meta name="google-site-verification" content="{{.}}" />{{ end }} + +<!-- Site Generator --> +<meta name="generator" content="Hugo {{ .Hugo.Version }}" /> + +<!-- Permalink & RSSlink --> +<link rel="canonical" href="{{ .Permalink }}" /> +{{ if .RSSLink -}} + <link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" /> + <link href="{{ .RSSLink }}" rel="feed" type="application/rss+xml" title="{{ .Site.Title }}" /> +{{ end -}} + +<!-- Favicon and Touch icons --> +<link rel="apple-touch-icon" sizes="180x180" href="{{ "apple-touch-icon.png" | relURL }}"> +<link rel="icon" type="image/png" sizes="32x32" href="{{ "favicon-32x32.png" | relURL }}"> +<link rel="icon" type="image/png" sizes="16x16" href="{{ "favicon-16x16.png" | relURL }}"> +<link rel="manifest" href="{{ "manifest.json" | relURL }}"> +<link rel="mask-icon" href="{{ "safari-pinned-tab.svg" | relURL }}" color="#5bbad5"> + +<!-- debug --> +{{- if .Site.Params.debug }} +<script src="https://cdn.jsdelivr.net/npm/eruda@1.2.6/eruda.min.js" integrity="sha256-Jmz4bc3kp+rRrXX2tGadNBKFLwtzMapr8kHABxSAAP8=" crossorigin="anonymous"></script> +<script>eruda.init();</script> +{{- end }} + +<!-- busuanzi --> +{{ if .Site.Params.busuanzi.enable -}} +<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script> +{{- end }} + +<!-- Styles --> +<link href="{{ "dist/even.min.css?v=3.2.0" | relURL }}" rel="stylesheet"> +{{ if .Site.Params.publicCDN.enable -}} + {{ if .Site.Params.fancybox }}{{ .Site.Params.publicCDN.fancyboxCss | safeHTML }}{{ end }} +{{- else -}} + {{ if .Site.Params.fancybox }}<link href="{{ "lib/fancybox/jquery.fancybox-3.1.20.min.css" | relURL }}" rel="stylesheet">{{ end }} +{{- end }} + +<!-- custom css --> +{{ range .Site.Params.customCSS }} +<link rel="stylesheet" href="{{ "/css/" | relURL }}{{ . }}"> +{{ end }} + +{{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/spf13/hugo/blob/master/tpl/tplimpl/template_embedded.go#L158 */}} +{{- template "_internal/opengraph.html" . -}} +{{- template "_internal/google_news.html" . -}} +{{- template "_internal/schema.html" . -}} +{{- template "_internal/twitter_cards.html" . -}} + +<!-- Polyfill for old browsers --> +{{ `<!--[if lte IE 9]> + <script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/1.1.20170427/classList.min.js"></script> +<![endif]-->` | safeHTML }} + +{{ `<!--[if lt IE 9]> + <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script> + <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script> +<![endif]-->` | safeHTML }} diff --git a/themes/even/layouts/partials/header.html b/themes/even/layouts/partials/header.html new file mode 100644 index 0000000..3592e88 --- /dev/null +++ b/themes/even/layouts/partials/header.html @@ -0,0 +1,19 @@ +<div class="logo-wrapper"> + <a href="{{ "/" | relLangURL }}" class="logo"> + {{- if .Site.Params.logoTitle -}} + {{ .Site.Params.logoTitle }} + {{- else -}} + {{ .Site.Title }} + {{- end -}} + </a> +</div> + +<nav class="site-navbar"> + <ul id="menu" class="menu"> + {{ range .Site.Menus.main -}} + <li class="menu-item"> + <a class="menu-item-link" href="{{ .URL | safeURL }}">{{ .Name }}</a> + </li> + {{- end }} + </ul> +</nav>
\ No newline at end of file diff --git a/themes/even/layouts/partials/post/copyright.html b/themes/even/layouts/partials/post/copyright.html new file mode 100644 index 0000000..cd42d68 --- /dev/null +++ b/themes/even/layouts/partials/post/copyright.html @@ -0,0 +1,32 @@ +{{ if or .Params.postMetaInFooter (and .Site.Params.postMetaInFooter (ne .Params.postMetaInFooter false)) -}} +<div class="post-copyright"> + <p class="copyright-item"> + <span class="item-title">{{ T "author" }}</span> + <span class="item-content">{{ if .Params.author }}{{ .Params.author | safeHTML }}{{ else }}{{ .Site.Author.name | safeHTML }}{{ end }}</span> + </p> + <p class="copyright-item"> + <span class="item-title">{{ T "lastMod" }}</span> + <span class="item-content">{{ .Lastmod.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}</span> + </p> + {{ if $.Site.Params.linkToMarkDown -}} + {{ with $.OutputFormats.Get "markdown" -}} + <p class="copyright-item"> + <span class="item-title">{{ T "markdown" }}</span> + <span class="item-content"><a class="link-to-markdown" href="{{ .Permalink }}" target="_blank">{{ T "seeMarkDown" }}</a></span> + </p> + {{- end }} + {{- end }} + {{ if or .Params.contentCopyright (and .Site.Params.contentCopyright (ne .Params.contentCopyright false)) -}} + <p class="copyright-item"> + <span class="item-title">{{ T "license" }}</span> + <span class="item-content"> + {{- if .Params.contentCopyright -}} + {{ .Params.contentCopyright | safeHTML }} + {{- else -}} + {{ .Site.Params.contentCopyright | safeHTML }} + {{- end -}} + </span> + </p> + {{- end }} +</div> +{{- end }}
\ No newline at end of file diff --git a/themes/even/layouts/partials/post/outdated-info-warning.html b/themes/even/layouts/partials/post/outdated-info-warning.html new file mode 100644 index 0000000..3736c13 --- /dev/null +++ b/themes/even/layouts/partials/post/outdated-info-warning.html @@ -0,0 +1,28 @@ +{{- if or .Params.enableOutdatedInfoWarning (and .Site.Params.outdatedInfoWarning.enable (ne .Params.enableOutdatedInfoWarning false)) }} + {{- $daysAgo := div (sub now.Unix .Lastmod.Unix) 86400 }} + {{- $hintThreshold := .Site.Params.outdatedInfoWarning.hint | default 30 }} + {{- $warnThreshold := .Site.Params.outdatedInfoWarning.warn | default 180 }} + + {{- $updateTime := .Lastmod }} + {{- if .GitInfo }} + {{- if lt .GitInfo.AuthorDate.Unix .Lastmod.Unix }} + {{- $updateTime := .GitInfo.AuthorDate }} + {{- end }} + {{- end -}} + + {{- if gt $daysAgo $hintThreshold }} + <div class="post-outdated"> + {{- if gt $daysAgo $warnThreshold }} + <div class="warn"> + {{- else }} + <div class="hint"> + {{- end }} + <p>{{ T "outdatedInfoWarningBefore" -}} + <span class="timeago" datetime="{{ dateFormat "2006-01-02T15:04:05" $updateTime }}" title="{{ dateFormat "January 2, 2006" $updateTime }}"> + {{- dateFormat "January 2, 2006" $updateTime -}} + </span>{{ T "outdatedInfoWarningAfter" -}} + </p> + </div> + </div> + {{- end -}} +{{- end -}} diff --git a/themes/even/layouts/partials/post/reward.html b/themes/even/layouts/partials/post/reward.html new file mode 100644 index 0000000..3242854 --- /dev/null +++ b/themes/even/layouts/partials/post/reward.html @@ -0,0 +1,21 @@ +{{ if or .Params.reward (and .Site.Params.reward.enable (ne .Params.reward false)) }} +<div class="post-reward"> + <input type="checkbox" name="reward" id="reward" hidden /> + <label class="reward-button" for="reward">{{ T "reward" }}</label> + <div class="qr-code"> + {{ $qrCode := .Site.Params.reward }} + {{ with $qrCode.wechat }} + <label class="qr-code-image" for="reward"> + <img class="image" src="{{ . }}"> + <span>{{ T "rewardWechat" }}</span> + </label> + {{- end }} + {{ with $qrCode.alipay }} + <label class="qr-code-image" for="reward"> + <img class="image" src="{{ . }}"> + <span>{{ T "rewardAlipay" }}</span> + </label> + {{- end }} + </div> +</div> +{{- end }}
\ No newline at end of file diff --git a/themes/even/layouts/partials/post/toc.html b/themes/even/layouts/partials/post/toc.html new file mode 100644 index 0000000..4fed1c7 --- /dev/null +++ b/themes/even/layouts/partials/post/toc.html @@ -0,0 +1,9 @@ +{{ if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) }} +<div class="post-toc" id="post-toc"> + <h2 class="post-toc-title">{{ T "toc" }}</h2> + {{ $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default false }} + <div class="post-toc-content{{ if not (or .Params.autoCollapseToc (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false))) }} always-active{{ end }}"> + {{.TableOfContents}} + </div> +</div> +{{- end }}
\ No newline at end of file diff --git a/themes/even/layouts/partials/scripts.html b/themes/even/layouts/partials/scripts.html new file mode 100644 index 0000000..803ac6a --- /dev/null +++ b/themes/even/layouts/partials/scripts.html @@ -0,0 +1,115 @@ +<!-- js --> +<script src="{{ "lib/highlight/highlight.pack.js?v=20171001" | relURL }}"></script> +{{- if .Site.Params.publicCDN.enable }} + {{ .Site.Params.publicCDN.jquery | safeHTML }} + {{ .Site.Params.publicCDN.slideout | safeHTML }} + {{ if .Site.Params.fancybox }}{{ .Site.Params.publicCDN.fancyboxJs | safeHTML }}{{ end }} +{{- else -}} + <script type="text/javascript" src="{{ "lib/jquery/jquery-3.2.1.min.js" | relURL }}"></script> + <script type="text/javascript" src="{{ "lib/slideout/slideout-1.0.1.min.js" | relURL }}"></script> + {{ if .Site.Params.fancybox }}<script type="text/javascript" src="{{ "lib/fancybox/jquery.fancybox-3.1.20.min.js" | relURL }}"></script>{{ end }} +{{- end -}} + +<!-- timeago.JS --> +{{- if and (or .Params.enableOutdatedInfoWarning (and .Site.Params.outdatedInfoWarning.enable (ne .Params.enableOutdatedInfoWarning false))) (or .IsPage .IsHome) }} + {{- if .Site.Params.publicCDN.enable }} + {{ .Site.Params.publicCDN.timeagoJS | safeHTML }} + {{ .Site.Params.publicCDN.timeagoLocalesJS | safeHTML }} + {{- else }} + <script type="text/javascript" src="{{ "lib/timeago/timeago-3.0.2.min.js" | relURL }}"></script> + <script type="text/javascript" src="{{ "lib/timeago/timeago.locales-3.0.2.min.js" | relURL }}"></script> + {{- end }} +<script> // NOTE: timeago.js uses the language code format like "zh_CN" (underscore and case sensitive) + var languageCode = {{ .Site.LanguageCode }}.replace(/-/g, '_').replace(/_(.*)/, function ($0, $1) {return $0.replace($1, $1.toUpperCase());}); + timeago().render(document.querySelectorAll('.timeago'), languageCode); + timeago.cancel(); // stop update +</script> +{{- end }} + +<!-- flowchart --> +{{- if and (or .Params.flowchartDiagrams.enable (and .Site.Params.flowchartDiagrams.enable (ne .Params.flowchartDiagrams.enable false))) (or .IsPage .IsHome) -}} +<script> + {{- if .Params.flowchartDiagrams.options -}} + window.flowchartDiagramsOptions = {{ .Params.flowchartDiagrams.options | safeJS }}; + {{- else if .Site.Params.flowchartDiagrams.options -}} + window.flowchartDiagramsOptions = {{ .Site.Params.flowchartDiagrams.options | safeJS }}; + {{- end -}} +</script> +<script src="https://cdn.jsdelivr.net/npm/raphael@2.2.7/raphael.min.js" integrity="sha256-67By+NpOtm9ka1R6xpUefeGOY8kWWHHRAKlvaTJ7ONI=" crossorigin="anonymous"></script> +<script src="https://cdn.jsdelivr.net/npm/flowchart.js@1.8.0/release/flowchart.min.js" integrity="sha256-zNGWjubXoY6rb5MnmpBNefO0RgoVYfle9p0tvOQM+6k=" crossorigin="anonymous"></script> +{{- end -}} + +<!-- js-sequence-diagrams --> +{{- if and (or .Params.sequenceDiagrams.enable (and .Site.Params.sequenceDiagrams.enable (ne .Params.sequenceDiagrams.enable false))) (or .IsPage .IsHome) -}} +<script> + {{- if .Params.sequenceDiagrams.options -}} + window.sequenceDiagramsOptions = {{ .Params.sequenceDiagrams.options | safeJS }}; + {{- else if .Site.Params.sequenceDiagrams.options -}} + window.sequenceDiagramsOptions = {{ .Site.Params.sequenceDiagrams.options | safeJS }}; + {{- end -}} +</script> +<script src="https://cdn.jsdelivr.net/npm/webfontloader@1.6.28/webfontloader.js" integrity="sha256-4O4pS1SH31ZqrSO2A/2QJTVjTPqVe+jnYgOWUVr7EEc=" crossorigin="anonymous"></script> +<script src="https://cdn.jsdelivr.net/npm/snapsvg@0.5.1/dist/snap.svg-min.js" integrity="sha256-oI+elz+sIm+jpn8F/qEspKoKveTc5uKeFHNNVexe6d8=" crossorigin="anonymous"></script> +<script src="https://cdn.jsdelivr.net/npm/underscore@1.8.3/underscore-min.js" integrity="sha256-obZACiHd7gkOk9iIL/pimWMTJ4W/pBsKu+oZnSeBIek=" crossorigin="anonymous"></script> +<script src="https://cdn.jsdelivr.net/gh/bramp/js-sequence-diagrams@2.0.1/dist/sequence-diagram-min.js" integrity="sha384-8748Vn52gHJYJI0XEuPB2QlPVNUkJlJn9tHqKec6J3q2r9l8fvRxrgn/E5ZHV0sP" crossorigin="anonymous"></script> +<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/bramp/js-sequence-diagrams@2.0.1/dist/sequence-diagram-min.css" integrity="sha384-6QbLKJMz5dS3adWSeINZe74uSydBGFbnzaAYmp+tKyq60S7H2p6V7g1TysM5lAaF" crossorigin="anonymous"> +{{- end }} +<script type="text/javascript" src="{{ "dist/even.min.js?v=3.2.0" | relURL }}"></script> + +{{- if and (or .Params.mathjax (and .Site.Params.mathjax (ne .Params.mathjax false))) (or .IsPage .IsHome) }} + <script type="text/javascript"> + window.MathJax = { + {{ if or .Params.mathjaxEnableSingleDollar (and .Site.Params.mathjaxEnableSingleDollar (ne .Params.mathjaxEnableSingleDollar false)) -}} + tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}, + {{ end -}} + {{ if or .Params.mathjaxEnableAutoNumber (and .Site.Params.mathjaxEnableAutoNumber (ne .Params.mathjaxEnableAutoNumber false)) -}} + TeX: {equationNumbers: {autoNumber: "AMS"}}, + {{ end -}} + showProcessingMessages: false, + messageStyle: 'none' + }; + </script> + <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"></script> +{{- end }} + +<!-- Analytics --> +{{- if .Site.GoogleAnalytics -}} + {{ template "_internal/google_analytics_async.html" . }} +{{- end -}} + +{{- with .Site.Params.baidu_analytics -}} +<script id="baidu_analytics"> + var _hmt = _hmt || []; + (function() { + if (window.location.hostname === 'localhost') return; + var hm = document.createElement("script"); hm.async = true; + hm.src = "https://hm.baidu.com/hm.js?{{.}}"; + var s = document.getElementsByTagName("script")[0]; + s.parentNode.insertBefore(hm, s); + })(); +</script> +{{- end }} + +<!-- baidu_push --> +{{- if .Site.Params.baidu_push -}} +<script id="baidu_push"> + (function(){ + if (window.location.hostname === 'localhost') return; + var bp = document.createElement('script'); bp.async = true; + var curProtocol = window.location.protocol.split(':')[0]; + if (curProtocol === 'https') { + bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; + } + else { + bp.src = 'http://push.zhanzhang.baidu.com/push.js'; + } + var s = document.getElementsByTagName("script")[0]; + s.parentNode.insertBefore(bp, s); + })(); +</script> +{{- end }} + +<!-- custom js --> +{{ range .Site.Params.customJS }} +<script src="{{ "/js/" | relURL }}{{ . }}"></script> +{{ end }} diff --git a/themes/even/layouts/partials/slideout.html b/themes/even/layouts/partials/slideout.html new file mode 100644 index 0000000..42ed13e --- /dev/null +++ b/themes/even/layouts/partials/slideout.html @@ -0,0 +1,25 @@ +<div id="mobile-navbar" class="mobile-navbar"> + <div class="mobile-header-logo"> + <a href="{{ "/" | relLangURL }}" class="logo"> + {{- if .Site.Params.logoTitle -}} + {{ .Site.Params.logoTitle }} + {{- else -}} + {{ .Site.Title }} + {{- end -}} + </a> + </div> + <div class="mobile-navbar-icon"> + <span></span> + <span></span> + <span></span> + </div> +</div> +<nav id="mobile-menu" class="mobile-menu slideout-menu"> + <ul class="mobile-menu-list"> + {{ range .Site.Menus.main -}} + <a href="{{ .URL | safeURL }}"> + <li class="mobile-menu-item">{{ .Name }}</li> + </a> + {{- end }} + </ul> +</nav>
\ No newline at end of file diff --git a/themes/even/layouts/post/single.html b/themes/even/layouts/post/single.html new file mode 100644 index 0000000..61fbf8c --- /dev/null +++ b/themes/even/layouts/post/single.html @@ -0,0 +1,72 @@ +{{ define "content" -}} + <article class="post"> + <!-- post-header --> + <header class="post-header"> + <h1 class="post-title">{{ .Title }}</h1> + + <div class="post-meta"> + <span class="post-time"> {{ .Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} </span> + {{ with .Params.categories -}} + <div class="post-category"> + {{ range . }} + <a href="{{ "categories" | relLangURL }}/{{ . | urlize }}/"> {{ . }} </a> + {{ end }} + </div> + {{- end }} + {{ if .Site.Params.moreMeta -}} + <span class="more-meta"> {{ T "wordCount" .WordCount }} </span> + <span class="more-meta"> {{ T "readingTime" .ReadingTime }} </span> + {{- end }} + {{ if and .Site.Params.busuanzi.enable .Site.Params.busuanzi.pagePV -}} + {{ $valueSpan := printf `<span id="busuanzi_value_page_pv"><img src="%s" alt="spinner.svg"/></span>` ("img/spinner.svg" | relURL) -}} + <span id="busuanzi_container_page_pv" class="more-meta"> {{ printf (T "pagePV") $valueSpan | safeHTML }} </span> + {{- end }} + </div> + </header> + + <!-- TOC --> + {{ partial "post/toc.html" . }} + + <!-- Outdated Info Warning --> + {{ partial "post/outdated-info-warning.html" . }} + + <!-- Content --> + <div class="post-content"> + {{ .Content }} + </div> + + <!-- Copyright --> + {{ partial "post/copyright.html" . }} + + <!-- Reward --> + {{ partial "post/reward.html" . }} + + <footer class="post-footer"> + {{ with .Params.tags -}} + <div class="post-tags"> + {{ range . }} + <a href="{{ "tags" | relLangURL }}/{{ . | urlize }}/">{{ . }}</a> + {{ end }} + </div> + {{- end }} + + <!-- Post Pagination --> + <nav class="post-nav"> + {{ with .NextInSection }} + <a class="prev" href="{{ .URL }}"> + <i class="iconfont icon-left"></i> + <span class="prev-text nav-default">{{ .Title }}</span> + <span class="prev-text nav-mobile">{{ T "prevPost" }}</span> + </a> + {{- end }} + {{ with .PrevInSection }} + <a class="next" href="{{ .URL }}"> + <span class="next-text nav-default">{{ .Title }}</span> + <span class="next-text nav-mobile">{{ T "nextPost" }}</span> + <i class="iconfont icon-right"></i> + </a> + {{- end }} + </nav> + </footer> + </article> +{{- end }} diff --git a/themes/even/layouts/post/summary.html b/themes/even/layouts/post/summary.html new file mode 100644 index 0000000..6069ca1 --- /dev/null +++ b/themes/even/layouts/post/summary.html @@ -0,0 +1,28 @@ +<article class="post"> + <header class="post-header"> + <h1 class="post-title"><a class="post-link" href="{{ .URL }}">{{ .Title }}</a></h1> + <div class="post-meta"> + <span class="post-time"> {{ .Date.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }} </span> + {{ with .Params.categories -}} + <div class="post-category"> + {{ range . }} + <a href="{{ "categories" | relLangURL }}/{{ . | urlize }}/"> {{ . }} </a> + {{ end }} + </div> + {{- end }} + {{ if .Site.Params.moreMeta -}} + <span class="more-meta"> {{ T "wordCount" .WordCount }} </span> + <span class="more-meta"> {{ T "readingTime" .ReadingTime }} </span> + {{- end }} + </div> + </header> + <!-- Content --> + <div class="post-content"> + <div class="post-summary"> + {{ .Summary }} + </div> + <div class="read-more"> + <a href="{{ .URL }}" class="read-more-link">{{ T "readMore" }}</a> + </div> + </div> +</article> diff --git a/themes/even/layouts/robots.txt b/themes/even/layouts/robots.txt new file mode 100644 index 0000000..e89778e --- /dev/null +++ b/themes/even/layouts/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Sitemap: {{ "sitemap.xml" | absURL }} diff --git a/themes/even/layouts/shortcodes/center.html b/themes/even/layouts/shortcodes/center.html new file mode 100644 index 0000000..e9022d0 --- /dev/null +++ b/themes/even/layouts/shortcodes/center.html @@ -0,0 +1,3 @@ +<div class='align-center'> + {{ .Inner }} +</div>
\ No newline at end of file diff --git a/themes/even/layouts/shortcodes/left.html b/themes/even/layouts/shortcodes/left.html new file mode 100644 index 0000000..c2c5102 --- /dev/null +++ b/themes/even/layouts/shortcodes/left.html @@ -0,0 +1,3 @@ +<div class='align-left'> + {{ .Inner }} +</div>
\ No newline at end of file diff --git a/themes/even/layouts/shortcodes/music.html b/themes/even/layouts/shortcodes/music.html new file mode 100644 index 0000000..22b2268 --- /dev/null +++ b/themes/even/layouts/shortcodes/music.html @@ -0,0 +1,62 @@ + {{/* + ## Music 163 + + ### Params: + + - `id` + + required param + you can extract from music url + url format "http://music.163.com/#/song?id=3950552" + + - Fiddle `auto` + + optional param + default value 0 + you can overwrite it with 1 + + ### Examples: + + - Simple + + {{% music "3950552" %}} + {{% music "3950552" "1" %}} + + - Named Params + + {{% music id="3950552" %}} + {{% music id="3950552" auto="1" %}} + + */}} + + {{- /* DEFAULTS */ -}} + {{ $auto := "0" }} + + {{- if .IsNamedParams -}} + + <iframe style="max-width: 100%" + class="music163" + frameborder="no" + border="0" + marginwidth="0" + marginheight="0" + width="330" + height="86" + src="//music.163.com/outchain/player?type=2&id={{ .Get "id" }}&auto={{ or (.Get "auto") $auto }}&height=66"> + </iframe> + + {{- else -}} + + <iframe style="max-width: 100%" + class="music163" + frameborder="no" + border="0" + marginwidth="0" + marginheight="0" + width="330" + height="86" + src="//music.163.com/outchain/player?type=2&id={{ .Get 0 }}&auto={{ if isset .Params 1 }}{{ .Get 1 }}{{ else }}{{ $auto }}{{ end }}&height=66"> + </iframe> + + {{- end -}} +
\ No newline at end of file diff --git a/themes/even/layouts/shortcodes/right.html b/themes/even/layouts/shortcodes/right.html new file mode 100644 index 0000000..37a9a33 --- /dev/null +++ b/themes/even/layouts/shortcodes/right.html @@ -0,0 +1,3 @@ +<div class='align-right'> + {{ .Inner }} +</div>
\ No newline at end of file diff --git a/themes/even/layouts/sitemap.xml b/themes/even/layouts/sitemap.xml new file mode 100644 index 0000000..19dd68d --- /dev/null +++ b/themes/even/layouts/sitemap.xml @@ -0,0 +1,11 @@ +{{ "<?" | safeHTML }}xml-stylesheet type="text/xsl" href="{{ "sitemap.xsl" | absURL }}"{{ "?>" | safeHTML }} +<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> + {{ range .Data.Pages }} + <url> + <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }} + <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }} + <changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }} + <priority>{{ .Sitemap.Priority }}</priority>{{ end }} + </url> + {{ end }} +</urlset>
\ No newline at end of file |