Initial commit

This commit is contained in:
mivinci 2021-07-18 16:34:01 +08:00
commit 063f2bb49a
34 changed files with 1341 additions and 0 deletions

0
layouts/404.html Normal file
View file

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
{{ partial "head.html" . }}
<body>
{{ partial "header.html" . }}
{{ block "main" . }} {{ end }}
{{ partial "footer.html" . }}
</body>
</html>

View file

@ -0,0 +1,17 @@
{{ define "main" }}
<main>
{{ if isset .Data "Term" }}
<h2>{{ .Data.Singular | title }} - "{{ .Data.Term }}"</h2>
{{ else }}
{{ end }}
<div>
{{ range .Data.Pages }}
<div class="row row-mob mb-1 mb-1_5-mob gap-3">
<div class="sm-2-mob mb-0_5-mob">{{ dateFormat "Jan 2, 2006" .Date }}</div>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</div>
{{ end }}
</div>
</main>
{{ end }}

View file

@ -0,0 +1,24 @@
{{ define "main" }}
<main>
<h1>{{ .Title }}</h1>
<div class="sm-1 mtb-1">
Posted at &mdash; {{ dateFormat "Jan 2, 2006" .Date }}
{{ if .Draft }}
<span class="tag ml-1">
DRAFT
</span>
{{ end }}
</div>
<p>{{ .Description }}</p>
<article class="md">
{{ .Content }}
</article>
</main>
{{ if or .Params.math .Site.Params.math }}
{{ partial "math.html" . }}
{{ end }}
{{ if .Params.disqus }}
{{ partial "disqus.html" . }}
{{ end }}
{{ end }}

View file

@ -0,0 +1,14 @@
{{ define "main" }}
<main>
<h2>{{ .Title }}</h2>
<nav class="col">
{{ $data := .Data }}
{{ range $key, $value := .Data.Terms.ByCount }}
<a class="row as-s mb-1" href="/{{ $data.Plural }}/{{ $value.Name }}">
{{ $value.Name }}
<span class="tag ml-1">{{ $value.Count }}</span>
</a>
{{ end }}
</nav>
</main>
{{ end }}

22
layouts/index.html Normal file
View file

@ -0,0 +1,22 @@
{{ define "main" }}
<main>
<h2 class="mb-0">I am {{ .Site.Author.name }}</h2>
<p>{{ .Site.Author.slogon }}</p>
<p>{{ .Site.Author.description }}</p>
{{ if eq .Paginator.PageNumber 1 }}
<h3>Recent Posts</h3>
{{ else }}
<h3>All Posts</h3>
{{ end }}
<div>
{{ $paginator := .Paginate (where .Site.RegularPages "Kind" "page") }}
{{ range $paginator.Pages }}
<div class="row row-mob mb-1 mb-1_5-mob gap-3">
<div class="sm-2-mob mb-0_5-mob">{{ dateFormat "Jan 2, 2006" .Date }}</div>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</div>
{{ end }}
{{ partial "paginator.html" . }}
</div>
</main>
{{ end }}

39
layouts/index.xml Normal file
View file

@ -0,0 +1,39 @@
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "RSS" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end -}}
{{ range $pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
<description>{{ .Summary | html }}</description>
</item>
{{ end }}
</channel>
</rss>

View file

@ -0,0 +1,16 @@
<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="https://disqus.com/?ref_noscript">comments powered by
Disqus.</a></noscript>

View file

@ -0,0 +1,18 @@
<footer class="row row-mob al-c-mob col-rev-mob sm-2-mob jc-bt mtb-2">
<p>
{{ .Site.Copyright }} |
<a href="https://github.com/mivinci/hugo-theme-minima" target="_blank" rel="noopener noreferrer">Minima</a> theme on
<a href="https://gohugo.io" target="_blank" rel="noopener noreferrer">Hugo</a>
</p>
<p class="row gap-0_5">
{{ range $_, $key := .Site.Params.Social }}
<a class="icon" href="{{ $key.url }}" title="{{ $key.name }}">
{{ if $key.svg }}
{{ $key.svg | safeHTML }}
{{ else }}
{{ index $.Site.Data.svg $key.name | safeHTML }}
{{ end }}
</a>
{{ end }}
</p>
</footer>

View file

@ -0,0 +1,37 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ template "_internal/opengraph.html" . }}
{{ template "_internal/twitter_cards.html" . }}
{{ template "_internal/google_analytics.html" . }}
<meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff">
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="#262d33">
<title>
{{ if .IsHome }}
{{ .Site.Title }} {{ if .Site.Params.subtitle }} - {{ .Site.Params.subtitle }} {{ end }}
{{ else }}
{{ .Site.Title }} - {{ .Title }}
{{ end }}
</title>
{{ $favicon := "favicon.ico" }}
<link rel="shortcut icon" href="{{ $favicon | relURL }}" type="image/x-icon" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="https://unpkg.com/normalize.css">
<link rel="stylesheet" type="text/css" media="screen" href="{{ .Site.BaseURL }}/css/main.css" />
<link rel="stylesheet" type="text/css" media="screen" href="{{ .Site.BaseURL }}/css/md.css" />
<link rel="stylesheet" type="text/css" media="screen" href="{{ .Site.BaseURL }}/css/syntax.css" />
<script src="{{ .Site.BaseURL }}/js/main.js"></script>
</head>
<script>
try {
if (!('theme' in localStorage)) {
localStorage.theme = window.matchMedia('(prefer-color-scheme: dark)').matches ? 'dark' : 'light';
}
document.querySelector('html').classList.add(localStorage.theme);
} catch (e) {
console.error(e);
}
</script>

View file

@ -0,0 +1,12 @@
<header>
<h1 class="row gap-1">
<div id="theme-switcher" class="btn lg-1"></div>
{{ .Site.Title }}
</h1>
<nav class="row gap-1">
{{ range .Site.Menus.main }}
<a href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
</nav>
<hr>
</header>

View file

@ -0,0 +1,25 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/katex.min.css"
integrity="sha384-Um5gpz1odJg5Z4HAmzPtgZKdTBHZdw8S29IecapCSB31ligYPhHQZMIlWLYQGVoc" crossorigin="anonymous">
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/katex.min.js"
integrity="sha384-YNHdsYkH6gMx9y3mRkmcJ2mFUjTd0qNQQvY9VYZgQd7DcN7env35GzlmFaZ23JGp" crossorigin="anonymous"></script>
<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.11/dist/contrib/auto-render.min.js"
integrity="sha384-vZTG03m+2yp6N6BNi5iM4rW4oIwk5DfcNdFfxkk9ZWpDriOkXX8voJBFrAO7MpVl" crossorigin="anonymous"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
renderMathInElement(document.body, {
// customised options
// • auto-render specific keys, e.g.:
delimiters: [
{ left: '$$', right: '$$', display: true },
{ left: '$', right: '$', display: false },
{ left: '\\(', right: '\\)', display: false },
{ left: '\\[', right: '\\]', display: true }
],
// • rendering keys, e.g.:
throwOnError: false
});
});
</script>

View file

@ -0,0 +1,10 @@
{{ $page := $.Paginator }}
{{ if gt $page.TotalPages 1 }}
<div class="mt-2">
{{ if $page.HasNext }}
<a href="{{ $page.Next.URL }}">Older →</a>
{{ else }}
<a href="{{ $page.Prev.URL }}">← Newer</a>
{{ end }}
</div>
{{ end }}