add language navigator and fix some styles

This commit is contained in:
Mivinci 2022-11-07 16:57:21 +08:00
parent 10dcb7a324
commit 59ee3f114a
21 changed files with 262 additions and 186 deletions

View file

@ -1,18 +1,20 @@
<footer class="mt-8 flex sm:flex-col-reverse justify-between items-center">
<p class="mt-0 text-sm">
{{ .Site.Copyright }} |
<a href="https://gohugo.io" target="_blank" rel="noopener noreferrer">Hugo</a> on
<a href="https://github.com/mivinci/hugo-theme-minima" target="_blank" rel="noopener noreferrer">Minima</a>
</p>
<p class="flex items-center mt-0">
{{ range $_, $key := .Site.Params.Social }}
<a class="icon mx-2" href="{{ $key.url }}" title="{{ $key.name }}">
{{ if $key.svg }}
{{ $key.svg | safeHTML }}
{{ else }}
{{ index $.Site.Data.svg $key.name | safeHTML }}
<footer class="mt-8">
<div class="container mt-8 flex sm:flex-col-reverse justify-between items-center">
<p class="mt-0 text-sm">
{{ .Site.Copyright }} |
<a href="https://gohugo.io" target="_blank" rel="noopener noreferrer">Hugo</a> on
<a href="https://github.com/mivinci/hugo-theme-minima" target="_blank" rel="noopener noreferrer">Minima</a>
</p>
<p class="flex items-center mt-0">
{{ range $_, $key := .Site.Params.Social }}
<a class="icon mx-2" href="{{ $key.url }}" title="{{ $key.name }}">
{{ if $key.svg }}
{{ $key.svg | safeHTML }}
{{ else }}
{{ index $.Site.Data.svg $key.name | safeHTML }}
{{ end }}
</a>
{{ end }}
</a>
{{ end }}
</p>
</p>
</div>
</footer>

View file

@ -15,18 +15,18 @@
</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">
{{ $hash := now.Unix }}
{{ $options := (dict "targetPath" (printf `minima.%d.css` $hash) "outputStyle" "compressed" "enableSourceMap" true) }}
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS $options }}
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
{{ $options = (dict "targetPath" (printf `minima.%d.js` $hash) "minify" true) }}
{{ $js := resources.Get "js/main.js" | js.Build $options | resources.ExecuteAsTemplate (printf `minima.%d.js` $hash) . }}
<script defer type="text/javascript" src="{{ $js.RelPermalink }}"></script>
{{ if .IsTranslated }}
{{ range .Translations }}
<link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}" title="{{ .Language.LanguageName }}">
{{ end }}
{{ end }}
</head>
<script>
// We will default to system theme color if no choice was made.

View file

@ -1,14 +1,23 @@
<header class="flex justify-between items-center mb-6 sm:my-3">
<div class="flex items-center">
{{ if .Site.Params.brand }}
<div class="mr-3 text-3xl"><a href="/">{{ .Site.Params.brand }}</a></div>
{{ end }}
<div id="theme-switcher" class="text-4xl cursor-pointer">{{ index .Site.Params.switch 1 }}</div>
<header class="sm:my-3 my-6">
<div class="container">
<nav class="flex justify-between items-center">
<div class="flex items-center">
{{ if .Site.Params.brand }}
<div class="mr-3 text-3xl"><a href="/">{{ .Site.Params.brand }}</a></div>
{{ end }}
<div id="theme-switcher" class="text-left text-4xl cursor-pointer">{{ index .Site.Params.switch 1 }}</div>
</div>
<ul class="flex items-center font-medium
whitespace-nowrap overflow-x-auto overflow-y-hidden">
{{ range .Site.Menus.main }}
<li class="mx-2"><a href="{{ .URL | absLangURL }}">{{ .Name }}</a></li>
{{ end }}
</ul>
<ul class="flex item-center text-sm font-bold">
{{ range $.Site.Home.AllTranslations }}
<li class="ml-3"><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li>
{{ end}}
</ul>
</nav>
</div>
<nav class="flex items-center
whitespace-nowrap overflow-x-auto overflow-y-hidden">
{{ range .Site.Menus.main }}
<a class="ml-5" href="{{ .URL | absLangURL }}">{{ .Name }}</a>
{{ end }}
</nav>
</header>

View file

@ -1,10 +1,10 @@
<div class="flex justify-between sm:flex-col-reverse my-3 sm:mb-6 sm:mt-3">
<div class="flex justify-between sm:flex-col my-3 sm:mb-4 sm:mt-3">
{{ if .Page.Params.link }}
<a class="" href="{{ .Page.Params.link }}">{{ .Title }}</a>
{{ else }}
<a class="" href="{{ .RelPermalink }}">{{ .Title }}</a>
{{ end }}
{{ if .Site.Params.displayDate }}
<div class="sm:mb-1 sm:text-xs">{{ dateFormat .Site.Params.timeformat .Date }}</div>
<div class="sm:mt-1 sm:text-xs">{{ dateFormat .Site.Params.timeformat .Date }}</div>
{{ end }}
</div>

View file

@ -1,6 +1,6 @@
{{ $page := $.Paginator }}
{{ if gt $page.TotalPages 1 }}
<div class="my-8 flex justify-between">
<div class="mt-6 flex justify-between font-semibold">
{{ if $page.HasPrev }}
<a href="{{ $page.Prev.URL }}">← Newer</a>
{{ end }}