feat: add blog list layout

chore: add toc to mobile dropdown menu single items

chore: refactor sidebar

chore: add single layout for blog

chore: add vscode settings

chore: add blog section

chore: add devcontainer.json

chore: exclude icon from mobile nav

chore: support multiple theme switches

- simplify theme switch implementation using data attributes
- hide theme switch when sidebar is disabled

chore: add theme switch to footer

- enable when sidebar is disabled

chore: add format-date partial
This commit is contained in:
Xin
2023-08-07 23:48:07 +01:00
parent 2f34627da3
commit a7aa9fa1cb
16 changed files with 429 additions and 75 deletions

21
layouts/blog/list.html Normal file
View File

@ -0,0 +1,21 @@
{{ define "main" }}
<div class="mx-auto flex max-w-[90rem]">
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true) }}
<article class="w-full break-words flex min-h-[calc(100vh-4rem)] min-w-0 justify-center pb-8 pr-[calc(env(safe-area-inset-right)-1.5rem)]">
<main class="w-full min-w-0 max-w-6xl px-6 pt-4 md:px-12">
<h1 class="text-4xl tracking-tighter text-center font-extrabold md:text-5xl mt-8 pb-6">{{ .Title }}</h1>
{{ range .Pages.ByDate }}
<div class="mb-10">
<h3><a style="color: inherit; text-decoration: none;" class="block font-semibold mt-8 text-2xl " href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
<p class="opacity-80 mt-6 leading-7">
{{- partial "utils/page-description" . }}
<span class="inline-block"> <a class="text-[color:hsl(var(--primary-hue),100%,50%)] underline underline-offset-2 decoration-from-font" href="{{ .RelPermalink }}">Read more →</a> </span>
</p>
<p class="opacity-50 text-sm mt-6 leading-7">{{ partial "utils/format-date" .Date }}</p>
</div>
{{ end }}
</main>
</article>
<div class="max-xl:hidden h-0 w-64 shrink-0"></div>
</div>
{{ end }}

33
layouts/blog/single.html Normal file
View File

@ -0,0 +1,33 @@
{{ define "main" }}
<div class="mx-auto flex max-w-[90rem]">
{{ partial "sidebar.html" (dict "context" . "disableSidebar" true) }}
{{ partial "toc.html" . }}
<article class="w-full break-words flex min-h-[calc(100vh-4rem)] min-w-0 justify-center pb-8 pr-[calc(env(safe-area-inset-right)-1.5rem)]">
<main class="w-full min-w-0 max-w-6xl px-6 pt-4 md:px-12">
{{ partial "breadcrumb.html" . }}
<h1 class="mt-2 text-4xl font-bold tracking-tight text-slate-900 dark:text-slate-100">{{ .Title }}</h1>
{{ with $date := .Date }}
<div class="mt-4 mb-16 text-gray-500 text-sm">
{{ partial "utils/format-date" $date }}
{{- if $.Params.authors }} by {{ end -}}
{{- with $.Params.authors }}
{{- range $i, $author := . -}}
{{- if $i }},{{ end -}}
{{- if $author.link }}
<a href="{{ $author.link }}" target="_blank" class="mx-1 text-current underline [text-underline-position:from-font] decoration-from-font">{{ $author.name }}</a>
{{ else }}
<span>{{ $author.name }}</span>
{{ end -}}
{{- end -}}
{{- end -}}
</div>
{{ end }}
<div class="content">
{{ .Content }}
</div>
<div class="mt-16"></div>
{{ partial "pager.html" . }}
</main>
</article>
</div>
{{ end }}