Initial commit
This commit is contained in:
commit
1f637ed41e
33 changed files with 832 additions and 0 deletions
3
themes/er/layouts/partials/back-to-top.html
Normal file
3
themes/er/layouts/partials/back-to-top.html
Normal file
|
@ -0,0 +1,3 @@
|
|||
{{ if .Site.Params.showScrollToTop | default true }}
|
||||
<a id="scroll-to-top" class="f6 o-0 link br2 ph2 pv1 mb1 bg-main-color pointer" onclick="topFunction()" style="color: #fff; visibility: hidden; display: none; transition: opacity .5s, visibility .5s;" title="back to top">back to top</a>
|
||||
{{ end }}
|
9
themes/er/layouts/partials/css/variables.css
Normal file
9
themes/er/layouts/partials/css/variables.css
Normal file
|
@ -0,0 +1,9 @@
|
|||
/*https://coolors.co/afd5aa-f0f2ef-a69f98-3d3d3d-8c6057*/
|
||||
:root {
|
||||
--main-color: #8C6056;
|
||||
--secondary-color: #AFD5AA;
|
||||
--logo-text-color: #fff;
|
||||
--body-text-color: #3d3d3d;
|
||||
--heading-text-color: #383838;
|
||||
--background-color: #fff;
|
||||
}
|
5
themes/er/layouts/partials/footer.html
Normal file
5
themes/er/layouts/partials/footer.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<footer class="content-width mt0 mt5-l mb4 f6 center ph3 gray tc tl-l">
|
||||
<hr class="dn db-l ml0-l gray w3"><br>
|
||||
Powered by <a href="https://gohugo.io/" target="_blank" class="link gray dim">Hugo</a>, based on the <a href="https://github.com/lingxz/er" target="_blank" class="link gray dim">Er</a> theme. <br>
|
||||
{{ with .Site.Copyright }}{{ . }}{{end}}
|
||||
</footer>
|
22
themes/er/layouts/partials/header.html
Normal file
22
themes/er/layouts/partials/header.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta content='text/html; charset=utf-8' http-equiv='content-type' />
|
||||
{{ partial "open_graph.html" . }}
|
||||
{{ hugo.Generator }}
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600" rel="stylesheet">
|
||||
<style type="text/css">{{ partial "css/variables.css" . | safeCSS }}</style>
|
||||
<link href='{{ "css/tachyons.min.css" | relURL }}' rel="stylesheet">
|
||||
<link href='{{ "css/styles.css" | relURL }}' rel="stylesheet">
|
||||
|
||||
<!-- Icon -->
|
||||
<link rel="icon"
|
||||
{{ if .Site.Params.favicon }}
|
||||
href="{{ .Site.Params.favicon | relURL }}"
|
||||
{{ else }}
|
||||
href='{{ "/favicon.ico" | relURL }}'
|
||||
{{ end }}
|
||||
type="image/x-icon"/>
|
||||
|
||||
<link href='{{ "/feed.xml" | relURL }}' rel="alternate" type="application/atom+xml" title="{{ .Site.Title }}" />
|
||||
{{ template "_internal/google_analytics_async.html" . }}
|
12
themes/er/layouts/partials/nav.html
Normal file
12
themes/er/layouts/partials/nav.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<nav class="{{ with .Site.Menus.main }}{{ if lt (len .) 3 }} flex {{ else }} flex-ns{{ end }}{{ end }} justify-between border-box pa3 pl3-l pr2-l mt1 mt0-ns" id="navbar">
|
||||
<div class="flex">
|
||||
<a class="f4 fw6 ttu no-underline dim bg-main-color pv1 ph2 br2" id="site-title" href='{{ "" | relURL }}' title="Home">{{ .Site.Title }}</a>
|
||||
</div>
|
||||
{{ with .Site.Menus.main }}
|
||||
<div class="{{ if lt (len . ) 3 }} flex-grow {{ else }} flex-ns mt2 mt0-ns{{ end }} pv1">
|
||||
{{ range . }}
|
||||
<a class="link dim dark-gray f6 dib mr2 mr3-l ttu tracked" href='{{.URL}}' title="{{ .Name }}">{{ .Name }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</nav>
|
48
themes/er/layouts/partials/open_graph.html
Normal file
48
themes/er/layouts/partials/open_graph.html
Normal file
|
@ -0,0 +1,48 @@
|
|||
{{ if .IsHome }}
|
||||
<title>{{ .Title }}</title>
|
||||
<meta content='{{ .Title }}' property='title' />
|
||||
<meta content='{{ .Title }}' property='og:title' />
|
||||
{{ else }}
|
||||
<title>{{ .Title }} - {{ .Site.Title }}</title>
|
||||
<meta content='{{ .Title }} - {{ .Site.Title }}' property='title' />
|
||||
<meta content='{{ .Title }} - {{ .Site.Title }}' property='og:title' />
|
||||
{{ end }}
|
||||
|
||||
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
|
||||
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
|
||||
<meta property="og:url" content="{{ .Permalink }}" />
|
||||
{{ with .Params.images }}{{ range first 6 . }}
|
||||
<meta property="og:image" content="{{ . | absURL }}" />
|
||||
{{ end }}{{ end }}
|
||||
{{ if .IsPage }}
|
||||
{{ if not .PublishDate.IsZero }}<meta property="article:published_time" content="{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/>
|
||||
{{ else if not .Date.IsZero }}<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/>{{ end }}
|
||||
{{ if not .Lastmod.IsZero }}<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/>{{ end }}
|
||||
{{ else }}
|
||||
{{ if not .Date.IsZero }}<meta property="og:updated_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/>{{ end }}
|
||||
{{ end }}{{ with .Params.audio }}
|
||||
<meta property="og:audio" content="{{ . }}" />{{ end }}{{ with .Params.locale }}
|
||||
<meta property="og:locale" content="{{ . }}" />{{ end }}{{ with .Site.Params.title }}
|
||||
<meta property="og:site_name" content="{{ . }}" />{{ end }}{{ with .Params.videos }}
|
||||
{{ range .Params.videos }}
|
||||
<meta property="og:video" content="{{ . | absURL }}" />
|
||||
{{ end }}{{ end }}
|
||||
<!-- If it is part of a series, link to related articles -->
|
||||
{{ $permalink := .Permalink }}
|
||||
{{ $siteSeries := .Site.Taxonomies.series }}{{ with .Params.series }}
|
||||
{{ range $name := . }}
|
||||
{{ $series := index $siteSeries $name }}
|
||||
{{ range $page := first 6 $series.Pages }}
|
||||
{{ if ne $page.Permalink $permalink }}<meta property="og:see_also" content="{{ $page.Permalink }}" />{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}{{ end }}
|
||||
{{ if .IsPage }}
|
||||
{{ range .Site.Authors }}{{ with .Social.facebook }}
|
||||
<meta property="article:author" content="https://www.facebook.com/{{ . }}" />{{ end }}{{ with .Site.Social.facebook }}
|
||||
<meta property="article:publisher" content="https://www.facebook.com/{{ . }}" />{{ end }}
|
||||
<meta property="article:section" content="{{ .Section }}" />
|
||||
{{ with .Params.tags }}{{ range first 6 . }}
|
||||
<meta property="article:tag" content="{{ . }}" />{{ end }}{{ end }}
|
||||
{{ end }}{{ end }}
|
||||
<!-- Facebook Page Admin ID for Domain Insights -->
|
||||
{{ with .Site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
|
9
themes/er/layouts/partials/pagination.html
Normal file
9
themes/er/layouts/partials/pagination.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{{ if gt .Paginator.TotalPages 1 }}
|
||||
<div class="pagination tc db fixed-l bottom-2-l right-2-l mb3 mb0-l">
|
||||
{{ partial "back-to-top.html" . }}<br>
|
||||
<p class="mb0 mt2">Page {{ .Paginator.PageNumber }} of {{ .Paginator.TotalPages }} <br>
|
||||
{{ if .Paginator.HasNext }}<a href="{{ .Paginator.Next.URL | relURL }}">Older Posts</a>{{ end }}
|
||||
{{ if .Paginator.HasPrev }}<a href="{{ .Paginator.Prev.URL | relURL }}">Newer Posts</a>{{ end }}
|
||||
</p>
|
||||
</div>
|
||||
{{ end }}
|
101
themes/er/layouts/partials/scripts.html
Normal file
101
themes/er/layouts/partials/scripts.html
Normal file
|
@ -0,0 +1,101 @@
|
|||
{{ if .Site.Params.showtoc | default true }}
|
||||
{{ $headers := findRE "<h[1-6].*?>(.|\n])+?</h[1-6]>" .Content }}
|
||||
{{ $has_headers := ge (len $headers) 1 }}
|
||||
{{ if and $has_headers (ne .Params.toc false) }}
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.min.js"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.css">
|
||||
<style>.is-active-link::before { background-color: var(--secondary-color); }</style>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if or (.Site.Params.showTagCloud | default true) (.Site.Params.showtoc | default true) (.Site.Params.showScrollToTop | default true) }}
|
||||
<script type="text/javascript">
|
||||
var prevScrollpos = window.pageYOffset;
|
||||
window.onscroll = function() {
|
||||
var currentScrollPos = window.pageYOffset;
|
||||
|
||||
{{ if .Site.Params.showTagCloud | default true }}
|
||||
if (document.getElementById("tag-cloud") !== null) {
|
||||
if (prevScrollpos > currentScrollPos) { // scroll up
|
||||
document.getElementById("tag-cloud").style.visibility = "visible";
|
||||
document.getElementById("tag-cloud").style.opacity = "1";
|
||||
} else {
|
||||
document.getElementById("tag-cloud").style.visibility = "hidden";
|
||||
document.getElementById("tag-cloud").style.opacity = "0";
|
||||
}
|
||||
}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.Params.showScrollToTop | default true }}
|
||||
if (document.body.scrollTop > 1000 || document.documentElement.scrollTop > 1000) {
|
||||
document.getElementById("scroll-to-top").style.display = "inline";
|
||||
document.getElementById("scroll-to-top").style.visibility = "visible";
|
||||
document.getElementById("scroll-to-top").style.opacity = "1";
|
||||
} else {
|
||||
document.getElementById("scroll-to-top").style.visibility = "hidden";
|
||||
document.getElementById("scroll-to-top").style.opacity = "0";
|
||||
}
|
||||
{{ end }}
|
||||
prevScrollpos = currentScrollPos;
|
||||
}
|
||||
{{ if .Site.Params.showScrollToTop | default true }}
|
||||
// When the user clicks on the button, scroll to the top of the document
|
||||
function topFunction() {
|
||||
document.body.scrollTop = 0; // For Safari
|
||||
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
|
||||
}
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.Params.showtoc | default true }}
|
||||
{{ $headers := findRE "<h[1-6].*?>(.|\n])+?</h[1-6]>" .Content }}
|
||||
{{ $has_headers := ge (len $headers) 1 }}
|
||||
{{ if and $has_headers (ne .Params.toc false) }}
|
||||
if (document.getElementById("contents-list") !== null && document.getElementsByClassName("post-content").length !== 0) {
|
||||
tocbot.init({
|
||||
// Where to render the table of contents.
|
||||
tocSelector: '#contents-list',
|
||||
// Where to grab the headings to build the table of contents.
|
||||
contentSelector: '.post-content',
|
||||
// Which headings to grab inside of the contentSelector element.
|
||||
headingSelector: 'h1, h2, h3',
|
||||
});
|
||||
}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</script>
|
||||
{{ end }}
|
||||
|
||||
{{ if .Params.math }}
|
||||
<!-- Load KaTeX -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/contrib/auto-render.min.js" integrity="sha384-dq1/gEHSxPZQ7DdrM82ID4YVol9BYyU7GbWlIwnwyPzotpoc57wDw/guX8EaYGPx" crossorigin="anonymous"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.css">
|
||||
<script>
|
||||
renderMathInElement(document.body,
|
||||
{
|
||||
delimiters: [
|
||||
{left: "$$", right: "$$", display: true},
|
||||
{left: "$", right: "$", display: false},
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
var inlineMathArray = document.querySelectorAll("script[type='math/tex']");
|
||||
for (var i = 0; i < inlineMathArray.length; i++) {
|
||||
var inlineMath = inlineMathArray[i];
|
||||
var tex = inlineMath.innerText || inlineMath.textContent;
|
||||
var replaced = document.createElement("span");
|
||||
replaced.innerHTML = katex.renderToString(tex, {displayMode: false});
|
||||
inlineMath.parentNode.replaceChild(replaced, inlineMath);
|
||||
}
|
||||
|
||||
var displayMathArray = document.querySelectorAll("script[type='math/tex; mode=display']");
|
||||
for (var i = 0; i < displayMathArray.length; i++) {
|
||||
var displayMath = displayMathArray[i];
|
||||
var tex = displayMath.innerHTML;
|
||||
var replaced = document.createElement("span");
|
||||
replaced.innerHTML = katex.renderToString(tex.replace(/%.*/g, ''), {displayMode: true});
|
||||
displayMath.parentNode.replaceChild(replaced, displayMath);
|
||||
}
|
||||
</script>
|
||||
{{end}}
|
9
themes/er/layouts/partials/table-of-contents.html
Normal file
9
themes/er/layouts/partials/table-of-contents.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<!-- ignore empty links with + -->
|
||||
{{ $headers := findRE "<h[1-6].*?>(.|\n])+?</h[1-6]>" .Content }}
|
||||
<!-- at least one header to link to -->
|
||||
{{ $has_headers := ge (len $headers) 1 }}
|
||||
<!-- a post can explicitly disable Table of Contents with toc: false -->
|
||||
{{ $show_toc := and (ne .Params.toc false) (ne .Site.Params.showtoc false) }}
|
||||
{{ if and $has_headers $show_toc }}
|
||||
<div class="tl fixed list-pages lh-copy" id="contents-list"></div>
|
||||
{{ end }}
|
9
themes/er/layouts/partials/tag_cloud.html
Normal file
9
themes/er/layouts/partials/tag_cloud.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{{ $maxtags := .Site.Params.maxTags | default 50 }}
|
||||
{{ if .Site.Params.showTagCloud | default true }}
|
||||
<div class="dn tr fixed right-2" id="tag-cloud">
|
||||
tags <br>
|
||||
{{ range first $maxtags .Site.Taxonomies.tags.ByCount }}
|
||||
<a class="silver no-underline" href="{{ "/tags/" | relLangURL }}{{ .Name | urlize }}">{{ .Name }}</a></li>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue