init: initial commit

This commit is contained in:
st1020 2023-10-20 22:53:59 +08:00
commit e38bcddf57
48 changed files with 3752 additions and 0 deletions

View file

@ -0,0 +1,24 @@
<footer class="mx-auto flex max-w-3xl flex-wrap items-center px-8 py-4 text-sm opacity-60">
<div class="mr-auto basis-full lg:basis-1/2">
&copy; {% if config.extra.footer.since %}{{ config.extra.footer.since }} - {% endif %} {{ now()
| date(format="%Y") }}
<a class="link" href="{{ get_url(path=``) }}"
>{{ config.author | default(value=config.title) }}</a
>
{% if config.extra.footer.license %} |<!---->
{% if config.extra.footer.license_url %}<!---->
<a class="link" href="{{ config.extra.footer.license_url }}">
{{ config.extra.footer.license }}
</a>
{% else %}<!---->
{{ config.extra.footer.license }}<!---->
{% endif %}<!---->
{% endif %}
</div>
<div class="flex basis-full lg:basis-1/2 lg:justify-end">
<a class="link mr-6 lg:ml-6" href="https://www.getzola.org/" rel="noopener" target="_blank"
>Powered by Zola</a
>
<a class="link" href="https://github.com/st1020/kita" rel="noopener" target="_blank">✎ Kita</a>
</div>
</footer>

View file

@ -0,0 +1,84 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<!-- Title -->
<title>
{% if page.title %}{{ config.title }} - {{ page.title }}{% else %}{{ config.title }}{% endif %}
</title>
<!-- Meta -->
<meta name="theme-color" />
<!-- Author -->
{% if page %}
<meta name="description" content="{{ page.summary | default(value=page.title) | safe }}" />
<meta name="author" content="{{ page.extra.author | default(value=page.title) }}" />
{% else %}
<meta name="description" content="{{ config.description | default(value=`A personal blog`) }}" />
<meta name="author" content="{{ config.author | default(value=config.title) }}" />
{% endif %}
<!-- CSS & JS -->
<link rel="preload stylesheet" as="style" href="{{ get_url(path=`main.css`) }}" />
<style>
:root {
--bg: {{ config.extra.style.bg_color | default(value="#f4f4f5") }};
--bg-dark: {{ config.extra.style.bg_dark_color | default(value="#18181b") }};
--header: {{ config.extra.style.header_color | default(value="#e4e4e7") }};
--header-dark: {{ config.extra.style.header_dark_color | default(value="#27272a") }};
}
</style>
<!-- Avatar -->
{% if config.extra.profile.avatar_url %}
<link rel="preload" as="image" href="{{ config.extra.profile.avatar_url }}" />
{% endif %}
<!-- Social List -->
{% if config.extra.profile.social %}
<!---->
{% for social in config.extra.profile.social %}
<link rel="preload" as="image" href="{{ get_url(path=social.name ~ `.svg`) }}" />
{% endfor %}
<!---->
{% endif %}
<!-- Dark Icon -->
<link rel="preload" as="image" href="{{ get_url(path=`theme.svg`) }}" />
<!-- Math -->
{% if page.extra.math | default(value=config.extra.math) %}
<!---->
{% include "partials/math.html" %}
<!---->
{% endif %}
<!---->
<!-- Favicon -->
<link rel="icon" href="{{ get_url(path=`favicon.ico`) }}" />
<link rel="apple-touch-icon" href="{{ get_url(path=`apple-touch-icon.png`) }}" />
<!-- Feeds -->
{% if config.generate_feed %} {% if config.feed_filename == "atom.xml" %}
<link
rel="alternate"
type="application/atom+xml"
title="Atom"
href="{{ get_url(path=`atom.xml`) }}"
/>
{% elif config.feed_filename == "rss.xml" %}
<link
rel="alternate"
type="application/rss+xml"
title="RSS"
href="{{ get_url(path=`rss.xml`) }}"
/>
{% endif %}
<!---->
{% endif %}
<!-- Canonical -->
<link rel="canonical" href="{{ page.permalink | default(value=get_url(path=``)) }}" />
</head>

View file

@ -0,0 +1,79 @@
<header
class="{% if config.extra.style.header_blur %}blur-header{% else %}header{% endif %} fixed top-0 z-40 mx-auto min-h-[3.5rem] w-full"
>
<div class="mx-auto w-full max-w-4xl p-3 lg:flex lg:justify-between">
<div class="flex justify-between">
<div class="flex items-center">
<a class="text-2xl font-semibold" href="{{ get_url(path=``) }}">{{ config.title }}</a>
<div
class="btn-dark ml-4 h-6 w-6 shrink-0 cursor-pointer text-[0] [background:url(./theme.svg)_left_center/cover_no-repeat] dark:invert dark:[background-position:right]"
role="button"
aria-label="Dark"
></div>
</div>
{% if config.extra.menu %}
<div
class="btn-menu relative z-50 flex h-8 w-8 shrink-0 cursor-pointer flex-col items-center justify-center gap-2.5 lg:hidden"
role="button"
aria-label="Menu"
></div>
{% endif %}
</div>
<script>
// base
const htmlClass = document.documentElement.classList;
setTimeout(() => {
htmlClass.remove("not-ready");
}, 10);
// mobile menu
const btnMenu = document.querySelector(".btn-menu");
btnMenu.addEventListener("click", () => {
htmlClass.toggle("open");
});
// dark theme
const setDark = (isDark) => {
htmlClass[isDark ? "add" : "remove"]("dark");
localStorage.setItem("dark", isDark);
};
// init
const darkScheme = window.matchMedia("(prefers-color-scheme: dark)");
if (htmlClass.contains("dark")) {
setDark(true);
} else {
const darkVal = localStorage.getItem("dark");
setDark(darkVal ? darkVal === "true" : darkScheme.matches);
}
// listen system
darkScheme.addEventListener("change", (event) => {
setDark(event.matches);
});
// manual switch
const btnDark = document.querySelector(".btn-dark");
btnDark.addEventListener("click", () => {
setDark(localStorage.getItem("dark") !== "true");
});
</script>
{% if config.extra.menu %}
<nav class="flex w-full items-center lg:w-auto">
<ul
class="nav-wrapper flex w-full flex-col py-2 lg:w-auto lg:flex-row lg:self-center lg:py-0"
>
{% for menu in config.extra.menu %}
<li>
<a
class="block py-2 text-center text-lg font-medium text-black dark:text-white lg:px-3 lg:py-0"
href="{{ menu.url }}"
>{{ menu.name }}</a
>
</li>
{% endfor %}
</ul>
</nav>
{% endif %}
</div>
</header>

View file

@ -0,0 +1,33 @@
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/katex@0.16.7/dist/katex.min.css"
integrity="sha384-3UiQGuEI4TTMaFmGIZumfRPtfKQ3trwQE2JgosJxCnGmQpL/lJdjpcHkaaFwHlcI"
crossorigin="anonymous"
/>
<script
defer
src="https://cdn.jsdelivr.net/npm/katex@0.16.7/dist/katex.min.js"
integrity="sha384-G0zcxDFp5LWZtDuRMnBkk3EphCK1lhEf4UEyEM693ka574TZGwo4IWwS6QLzM/2t"
crossorigin="anonymous"
></script>
<script
defer
src="https://cdn.jsdelivr.net/npm/katex@0.16.7/dist/contrib/auto-render.min.js"
integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05"
crossorigin="anonymous"
></script>
<script>
document.addEventListener("DOMContentLoaded", () =>
renderMathInElement(document.body, {
// customised options
// • auto-render specific keys, e.g.:
delimiters: [
{ left: "$$", right: "$$", display: true },
{ left: "$", right: "$", display: false },
],
// • rendering keys, e.g.:
throwOnError: false,
}),
);
</script>

View file

@ -0,0 +1,13 @@
<div class="text-sm antialiased opacity-60">
{% if page.date %}
<time>{{ page.date | date }}</time>
<span class="mx-1">&middot;</span>
<span>{{ page.reading_time }}min</span>
{% endif %}<!---->
{% set single_author = page.extra.author | default(value=config.author) %}
<!---->
{% if single_author %}
<span class="mx-1">&middot;</span>
<span>{{ single_author }}</span>
{% endif %}
</div>

View file

@ -0,0 +1,49 @@
<!-- Pages -->
{% if pages is defined %}<!---->
{% elif paginator is defined %}<!---->
{% set pages = paginator.pages %}<!---->
{% elif term is defined %}<!---->
{% set pages = term.pages %}<!---->
{% elif section is defined %}<!---->
{% set pages = section.pages %}<!---->
{% endif %}<!---->
{% for page in pages %}
<section
class="relative mb-4 rounded-lg bg-white/80 p-4 first-of-type:mt-0 last-of-type:mb-0 active:scale-95 dark:bg-white/[8%] lg:mb-6 lg:p-6"
>
<h2 class="!my-0 pb-1 font-bold !leading-none">{{ page.title }}</h2>
<div class="not-prose my-1 truncate">
{% if page.description %}
<p>{{ page.description }}</p>
{% elif page.summary %}<!---->
{{ page.summary | safe }}<!---->
{% endif %}
</div>
{% include "partials/page_info.html" %}
<a class="absolute inset-0 text-[0]" href="{{ page.permalink }}">{{ page.title }}</a>
</section>
{% endfor %}
<!-- Main Nav -->
{% if paginator is defined %}
<nav class="mt-16 flex">
{% if paginator.previous %}
<a
class="rounded-full bg-black px-4 py-3 text-sm text-white no-underline shadow duration-100 active:scale-95 dark:bg-white/80 dark:text-black"
href="{{ paginator.previous }}"
>← Prev Page</a
>
{% endif %}<!---->
{% if paginator.next %}
<a
class="ml-auto rounded-full bg-black px-4 py-3 text-sm text-white no-underline shadow duration-100 active:scale-95 dark:bg-white/80 dark:text-black"
href="{{ paginator.next }}"
>Next Page →</a
>
{% endif %}
</nav>
{% endif %}