aboutsummaryrefslogtreecommitdiff
path: root/www/layouts
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-02-24 02:18:20 +0800
committerYuqian Yang <crupest@crupest.life>2025-02-26 02:21:41 +0800
commit0c885ba1bf30ce8308880f926be85b6f5a499fa6 (patch)
tree25f42a9386f760c9d7d47d9b154e4a0089e49dff /www/layouts
parentdc7b27c713351066e20947ea6d1adb80aeb68d9f (diff)
downloadcrupest-0c885ba1bf30ce8308880f926be85b6f5a499fa6.tar.gz
crupest-0c885ba1bf30ce8308880f926be85b6f5a499fa6.tar.bz2
crupest-0c885ba1bf30ce8308880f926be85b6f5a499fa6.zip
feat(www): YEAH!
Diffstat (limited to 'www/layouts')
-rw-r--r--www/layouts/_default/baseof.html54
-rw-r--r--www/layouts/_default/list.html12
-rw-r--r--www/layouts/_default/single.html17
-rw-r--r--www/layouts/partials/css.html9
-rw-r--r--www/layouts/partials/date.html1
-rw-r--r--www/layouts/partials/js.html9
-rw-r--r--www/layouts/partials/nav.html6
-rw-r--r--www/layouts/partials/preview/article.html10
-rw-r--r--www/layouts/partials/preview/post.html7
-rw-r--r--www/layouts/partials/preview/posts.html7
-rw-r--r--www/layouts/real-home/home.html93
11 files changed, 225 insertions, 0 deletions
diff --git a/www/layouts/_default/baseof.html b/www/layouts/_default/baseof.html
new file mode 100644
index 0000000..defa6ac
--- /dev/null
+++ b/www/layouts/_default/baseof.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <meta charset="UTF-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <link rel="icon" href="/favicon.ico" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>{{ block "title" . }}
+ {{ .Site.Title }}
+ {{ end }}</title>
+ {{ with resources.Get "catppuccin-latte.css" | minify | fingerprint }}
+ <style>{{ printf `@import url(%s);` .RelPermalink | safeCSS }}</style>
+ {{ end }}
+ {{ with resources.Get "catppuccin-mocha.css" | minify | fingerprint }}
+ <style>{{ printf `@import url(%s) (prefers-color-scheme: dark);` .RelPermalink | safeCSS }}</style>
+ {{ end }}
+ {{ partial "css.html" "base-style.css" }}
+ {{ block "head" . }}
+ {{ end }}
+ </head>
+ <body>
+ {{ partial "js.html" "color-scheme.ts" }}
+ <div id="slogan">
+ <span>🙃The world is full of pain, but we can fix it with love!</span>
+ </div>
+ {{ block "pre-article" .}}
+ {{ end }}
+ <article id="main-article">
+ {{ block "content" . }}
+ {{ end }}
+ <hr/>
+ <footer class="mono-link">
+ <p id="license">
+ <small>This work is licensed under
+ <a rel="license noopener noreferrer"
+ href="https://creativecommons.org/licenses/by-nc/4.0/"
+ target="_blank">
+ <span id="license-text">CC BY-NC 4.0</span>
+ <span id="license-img-container">
+ <img src="https://mirrors.creativecommons.org/presskit/icons/cc.svg"/>
+ <img src="https://mirrors.creativecommons.org/presskit/icons/by.svg"/>
+ <img src="https://mirrors.creativecommons.org/presskit/icons/nc.svg"/>
+ </span>
+ </a>
+ </small>
+ </p>
+ </footer>
+ </article>
+
+ {{ block "scripts" . }}
+ {{ end }}
+</body>
+</html>
diff --git a/www/layouts/_default/list.html b/www/layouts/_default/list.html
new file mode 100644
index 0000000..ddc3942
--- /dev/null
+++ b/www/layouts/_default/list.html
@@ -0,0 +1,12 @@
+{{ define "head"}}
+ {{ partial "css.html" "partials/preview/article.css" }}
+{{ end }}
+
+{{ define "content" }}
+ {{ partial "nav.html" . }}
+ <h1>Posts</h1>
+ {{ partial "preview/posts.html" (dict
+ "h" "h3"
+ "pages" (.RegularPages.ByDate.Reverse.Limit 3))
+ }}
+{{ end }}
diff --git a/www/layouts/_default/single.html b/www/layouts/_default/single.html
new file mode 100644
index 0000000..83297cf
--- /dev/null
+++ b/www/layouts/_default/single.html
@@ -0,0 +1,17 @@
+{{ define "head"}}
+ {{ partial "css.html" "single.css" }}
+{{ end }}
+
+{{ define "title" }}
+ {{ .Title }}
+{{ end }}
+
+{{ define "content" }}
+ {{ partial "nav.html" . }}
+ <h1 class="post-title">{{ .Title }}</h1>
+ <hr/>
+ <p class="post-info"><span class="created">{{ partial "date.html" .Date }}</span> <span class="last-updated">Last updated: {{ partial "date.html" .Lastmod }}</span></p>
+ {{ .Content }}
+ <hr class="end-hr"/>
+ {{ partial "nav.html" . }}
+{{ end }}
diff --git a/www/layouts/partials/css.html b/www/layouts/partials/css.html
new file mode 100644
index 0000000..5ddd65b
--- /dev/null
+++ b/www/layouts/partials/css.html
@@ -0,0 +1,9 @@
+{{ with resources.Get . | minify }}
+ {{ if hugo.IsProduction }}
+ {{ with . | fingerprint }}
+ <link href="{{ .RelPermalink }}" rel="stylesheet" integrity="{{ .Data.Integrity }}">
+ {{ end }}
+ {{ else }}
+ <link href="{{ .RelPermalink }}" rel="stylesheet">
+ {{ end }}
+{{ end }}
diff --git a/www/layouts/partials/date.html b/www/layouts/partials/date.html
new file mode 100644
index 0000000..9769e4e
--- /dev/null
+++ b/www/layouts/partials/date.html
@@ -0,0 +1 @@
+<time datetime="{{ . | time.Format "RFC3339"}}">{{ . | time.Format ":date_medium" }}</time> \ No newline at end of file
diff --git a/www/layouts/partials/js.html b/www/layouts/partials/js.html
new file mode 100644
index 0000000..a4e8048
--- /dev/null
+++ b/www/layouts/partials/js.html
@@ -0,0 +1,9 @@
+{{ with resources.Get . }}
+ {{ if hugo.IsProduction }}
+ {{ with . | js.Build (dict "minify" true "sourceMap" "external") | fingerprint }}
+ <script src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}"></script>
+ {{ end }}
+ {{ else }}
+ <script src="{{ (. | js.Build dict) .RelPermalink }}"></script>
+ {{ end }}
+{{ end }}
diff --git a/www/layouts/partials/nav.html b/www/layouts/partials/nav.html
new file mode 100644
index 0000000..42c9ad1
--- /dev/null
+++ b/www/layouts/partials/nav.html
@@ -0,0 +1,6 @@
+<nav class="mono">
+ {{ range .Ancestors.Reverse }}
+ <a class="mono-link" href="{{ .RelPermalink }}">{{ lower .Title }}</a> >
+ {{ end }}
+ this
+</nav>
diff --git a/www/layouts/partials/preview/article.html b/www/layouts/partials/preview/article.html
new file mode 100644
index 0000000..6245434
--- /dev/null
+++ b/www/layouts/partials/preview/article.html
@@ -0,0 +1,10 @@
+<section class="article-preview">
+ <span class="date">{{ .date | time.Format ":date_medium" }}</span>
+ {{ (printf `<%[1]s class="title"><a href="%s">%s</a></%[1]s>` .h .link .title) | safeHTML }}
+ <p class="content">
+ {{ range split .content "\n" | first 5 }}
+ {{ . | htmlUnescape }}<br/>
+ {{ end }}
+ </p>
+ <p>... <a class="mono-link" href="{{ .link }}">Read more</a></p>
+</section>
diff --git a/www/layouts/partials/preview/post.html b/www/layouts/partials/preview/post.html
new file mode 100644
index 0000000..f0c6fb5
--- /dev/null
+++ b/www/layouts/partials/preview/post.html
@@ -0,0 +1,7 @@
+{{ partial "preview/article.html" (dict
+ "h" .h
+ "title" .page.Title
+ "link" .page.RelPermalink
+ "content" .page.Plain
+ "date" .page.Date)
+}}
diff --git a/www/layouts/partials/preview/posts.html b/www/layouts/partials/preview/posts.html
new file mode 100644
index 0000000..f2cb640
--- /dev/null
+++ b/www/layouts/partials/preview/posts.html
@@ -0,0 +1,7 @@
+{{ $h := .h }}
+{{ range .pages }}
+ {{ partial "preview/post.html" (dict
+ "h" $h
+ "page" .)
+ }}
+{{ end }} \ No newline at end of file
diff --git a/www/layouts/real-home/home.html b/www/layouts/real-home/home.html
new file mode 100644
index 0000000..3de9903
--- /dev/null
+++ b/www/layouts/real-home/home.html
@@ -0,0 +1,93 @@
+{{ define "head"}}
+ {{ partial "css.html" "real-home.css" }}
+ {{ partial "css.html" "partials/preview/article.css" }}
+{{ end }}
+
+{{ define "friend" }}
+ {{ $gh_url := printf "https://github.com/%s" .github}}
+ <div class="friend">
+ <a rel="noopener noreferrer" href="{{ or .url $gh_url }}">
+ <img class="friend-avatar" alt="Friend {{.name}}'s avatar" src="{{.avatar}}" width="80"
+ height="80" /><br />{{.name}}</a>
+ <a rel="noopener noreferrer" href="{{ $gh_url }}">
+ {{- with resources.Get "github-mark.png" -}}
+ <img class="friend-github" src="{{ .RelPermalink }}" />
+ {{- end -}}
+ </a><br />
+ {{ if .tag }}
+ <span class="friend-tag">{{ .tag }}</span>
+ {{ end }}
+ </div>
+{{ end }}
+
+{{ define "content"}}
+ <img id="avatar" src="/avatar.png" alt="My avatar" width="80" height="80" />
+ <h1 id="title">Hello! This is <span id="title-name">crupest</span> !</h1>
+ <hr />
+ <section>
+ <p>Welcome to my home page! Nice to meet you here! 🥰</p>
+ <p>If you have something interesting to share with me, feel free to email me at
+ <a rel="noopener noreferrer" href="mailto:crupest@crupest.life">crupest@crupest.life</a>.
+ </p>
+ <p>You can also create an issue in any of my repos on GitHub to talk anything to me,
+ <a rel="noopener noreferrer" href="https://github.com/crupest">https://github.com/crupest</a>.
+ </p>
+ </section>
+ <hr>
+ {{ with .Site.GetPage "posts" }}
+ <section id="recent-posts">
+ <h2>Recent Posts <a class="mono-link" href="{{ .RelPermalink }}">(all)</a></h2>
+ {{ partial "preview/posts.html" (dict
+ "h" "h3"
+ "pages" (.RegularPages.ByDate.Reverse.Limit 3))
+ }}
+ </section>
+ {{ end }}
+ <hr>
+ <section>
+ <h2 id="friends">My Friends <small>(more links are being collected ...)</small></h2>
+ <div id="friends-container">
+ {{ block "friend" dict
+ "name" "wsm"
+ "avatar" "https://avatars.githubusercontent.com/u/74699943?v=4"
+ "github" "wushuming666"
+ }}
+ {{ end }}
+ {{ block "friend" dict
+ "name" "hsz"
+ "url" "https://www.hszsoft.com"
+ "avatar" "https://avatars.githubusercontent.com/u/63097618?v=4"
+ "github" "hszSoft"
+ "tag" "随性の程序员"
+ }}
+ {{ end }}
+ </div>
+ </section>
+ <section class="mono-link">
+ <h2>Other Links</h2>
+ <ul>
+ <li><a rel="noopener noreferrer" href="{{ .RelPermalink }}">{{ .RelPermalink }}</a>
+ : home page, aka the one you are reading, built with <a rel="noopener noreferrer"
+ href="https://gohugo.io">hugo</a>.</li>
+ <li><a rel="noopener noreferrer" href="{{ absURL "/git/" }}">{{ absURL "/git/" }}</a>
+ : my git repos and <a rel="noopener noreferrer" href="https://git.zx2c4.com/cgit/">cgit</a> for viewing them.</li>
+ <li><del><span class="fake-link">{{ .Site.Params.timeline }}</span> : micro-blog with my own web app
+ <a rel="noopener noreferrer" href="https://github.com/crupest/Timeline">Timeline</a>.</del>
+ No longer maintain, so it stops serving due to security concerns.</li>
+ </ul>
+ </section>
+ <hr>
+ <section>
+ <h2>Always Remember</h2>
+ <figure class="citation">
+ <blockquote>
+ <p>Die Philosophen haben die Welt nur verschieden interpretiert, es kömmt aber darauf an, sie zu verändern.</p>
+ <p><small>Translated from German:</small>
+ The philosophers have only interpreted the world in various ways, the point is to change it.</p>
+ </blockquote>
+ <figcaption>
+ <cite>Karl Marx, Theses on Feuerbach (1845)</cite>
+ </figcaption>
+ </figure>
+ </section>
+{{ end }} \ No newline at end of file