Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wlh320/hugo-theme-hulga.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzilch40 <wlh233@live.com>2020-11-16 15:31:39 +0300
committerzilch40 <wlh233@live.com>2020-11-16 15:31:39 +0300
commit871470c4cd13a02e947680864574a84eae246cf0 (patch)
tree8414d26b020681fa0b05384c28bccc08d69e4e4b /layouts
parent88fb497815279a64bbfe38e7cdd1676a2b683b77 (diff)
add PWA support && tweak some pages
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html4
-rw-r--r--layouts/_default/taxonomy.html4
-rw-r--r--layouts/archives/single.html10
-rw-r--r--layouts/index.html5
-rw-r--r--layouts/partials/footer.html3
-rw-r--r--layouts/partials/head.html117
-rw-r--r--layouts/partials/nav.html4
-rw-r--r--layouts/partials/paginator.html4
-rw-r--r--layouts/partials/post-header.html37
-rw-r--r--layouts/partials/post.html43
-rw-r--r--layouts/partials/posts.html4
-rw-r--r--layouts/partials/pwa.html3
12 files changed, 135 insertions, 103 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index ea5525d..4a3a564 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -1,5 +1,5 @@
-<!DOCTYPE html>
-<html>
+<!DOCTYPE html>
+<html {{if .Site.LanguageCode}}lang="{{.Site.LanguageCode}}"{{end}}>
{{- partial "head.html" . -}}
<body>
diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html
index 5344be9..23de21f 100644
--- a/layouts/_default/taxonomy.html
+++ b/layouts/_default/taxonomy.html
@@ -8,7 +8,7 @@
{{ if eq .Data.Singular "category" }}
<div class="card">
<header class="card-header is-primary">
- <p class="card-header-title">
+ <p class="card-header-title content is-medium">
{{ i18n "categories" }}
</p>
</header>
@@ -31,7 +31,7 @@
{{ if eq .Data.Singular "tag" }}
<div class="card">
<header class="card-header">
- <p class="card-header-title">
+ <p class="card-header-title content is-medium">
{{ i18n "tags" }}
</p>
</header>
diff --git a/layouts/archives/single.html b/layouts/archives/single.html
index f19ccac..728e628 100644
--- a/layouts/archives/single.html
+++ b/layouts/archives/single.html
@@ -1,15 +1,17 @@
{{ define "main" }}
-{{ partial "header.html" . }}
+{{ partial "post-header.html" . }}
<section class="section">
<div class="container content">
<div class="columns">
<div class="column is-8 is-offset-2">
- {{ $count := len (where (where .Site.Pages "Type" "post") "Kind" "page") }}
- <h2 class="has-text-centered">{{ i18n "archives" (dict "Count" $count) }}</h2>
<div class="post-archive">
{{ range (where (where .Site.Pages "Type" "post") "Kind" "page").GroupByDate "2006" }}
<div class="box container">
- <h3>{{ .Key }}</h3>
+ <h3>{{ .Key }}
+ <span class="tag is-medium is-pulled-right">
+ {{ len .Pages }}
+ </span>
+ </h3>
<ul class="listing">
{{ range .Pages }}
<li>
diff --git a/layouts/index.html b/layouts/index.html
index ca7abab..62f5e5d 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1 +1,4 @@
-{{ with .GetPage "/post" }}{{.Render}}{{end}}
+{{ define "main" }}
+{{- partial "header.html" . -}}
+{{- partial "posts.html" . -}}
+{{ end }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index b698406..7df832c 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -10,4 +10,7 @@
</p>
</div>
</footer>
+{{ if .Site.Params.pwa }}
+{{ partial "pwa.html" . }}
+{{ end}}
{{ template "_internal/google_analytics_async.html" . }}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index de32ad1..4e9aac9 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -1,51 +1,72 @@
<head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- {{ if .IsHome -}}
- <title>{{ .Site.Title }} | {{ .Site.Params.subtitle}}</title>
- <meta property="og:title" content="{{ .Site.Title }} | {{ .Site.Params.subtitle}}">
- <meta property="og:type" content="website">
- {{ if .Site.Params.keywords }}
- <meta name="Keywords" content="{{.Site.Params.keywords}}">
- {{ end }}
- {{ if .Site.Params.keywords }}
- <meta name="description" content="{{ .Site.Params.description }}">
- {{ end }}
- {{- else -}}
- <title>{{ .Title }} | {{ .Site.Title }}</title>
- <meta property="og:title" content="{{ .Title }} - {{ .Site.Title }}">
- <meta property="og:type" content="article">
- {{ with .Params.date }}
- <meta property="article:published_time" content="{{ .Format "2006-01-02T15:04:05+08:00" }}">
- {{ end }}
- {{ with .Params.lastmod }}
- <meta property="article:modified_time" content="{{ .Format "2006-01-02T15:04:05+08:00" }}">
- {{ end }}
- <meta name="Keywords" content="{{ if .Keywords }}{{ .Keywords }}{{ else }}{{ .Site.Params.keywords }}{{ end }}">
- <meta name="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Title }}{{ end }}">
- {{ if .Params.author -}}
- <meta name="author" content="{{ .Params.author }}">
- {{- end }}
- {{- end }}
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
+ <link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
+ <link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
+ <link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
+ <link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
+ <link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
+ <link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
+ <link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
+ <link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
+ <link rel="icon" type="image/png" sizes="192x192" href="/android-icon-192x192.png">
+ <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
+ <link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png">
+ <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
+ <meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
+ {{- if .Site.Params.primaryColor -}}
+ <meta name="msapplication-TileColor" content="{{.Site.Params.primaryColor}}">
+ <meta name="theme-color" content="{{.Site.Params.primaryColor}}">
+ {{- end -}}
+ {{ if .IsHome -}}
+ <title>{{ .Site.Title }} | {{ .Site.Params.subtitle}}</title>
+ <meta property="og:title" content="{{ .Site.Title }} | {{ .Site.Params.subtitle }}">
+ <meta property="og:type" content="website">
+ {{ if .Site.Params.keywords }}
+ <meta name="Keywords" content="{{.Site.Params.keywords}}">
+ {{ end }}
+ {{ if .Site.Params.keywords }}
+ <meta name="description" content="{{ .Site.Params.description }}">
+ {{ end }}
+ {{- else -}}
+ <title>{{ .Title }} | {{ .Site.Title }}</title>
+ <meta property="og:title" content="{{ .Title }} - {{ .Site.Title }}">
+ <meta property="og:type" content="article">
+ {{ with .Params.date }}
+ <meta property="article:published_time" content="{{ .Format "2006-01-02T15:04:05+08:00" }}">
+ {{ end }}
+ {{ with .Params.lastmod }}
+ <meta property="article:modified_time" content="{{ .Format "2006-01-02T15:04:05+08:00" }}">
+ {{ end }}
+ <meta name="Keywords" content="{{ if .Keywords }}{{ .Keywords }}{{ else }}{{ .Site.Params.keywords }}{{ end }}">
+ <meta name="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Title }}{{ end }}">
+ {{ if .Params.author -}}
+ <meta name="author" content="{{ .Params.author }}">
+ {{- end }}
+ {{- end }}
- {{ $options := (dict "outputStyle" "compressed" "includePaths" (slice "sass")) }}
- {{ $lightScss := resources.Get "css/hulga.scss" }}
- {{ $darkScss := resources.Get "css/hulga-dark.scss" }}
- {{ if .Site.Params.postcss }}
- {{ $light := $lightScss | resources.ExecuteAsTemplate "css/hulga.scss" . | resources.ToCSS $options | postCSS | resources.Minify }}
- <link rel="stylesheet" type="text/css" href="{{ $light.Permalink | relURL }}">
- {{ if .Site.Params.darkMedia }}
- {{ $dark := $darkScss | resources.ExecuteAsTemplate "css/hulga-dark.scss" . | resources.ToCSS $options | postCSS | resources.Minify }}
- <link rel="stylesheet" type="text/css" href="{{ $dark.Permalink | relURL }}" media="(prefers-color-scheme: dark)">
- {{ end }}
- {{ else }}
- {{ $light := $lightScss | resources.ExecuteAsTemplate "css/hulga.scss" . | resources.ToCSS $options }}
- <link rel="stylesheet" type="text/css" href="{{ $light.Permalink | relURL }}">
- {{ if .Site.Params.darkMedia }}
- {{ $dark := $darkScss | resources.ExecuteAsTemplate "css/hulga-dark.scss" . | resources.ToCSS $options }}
- <link rel="stylesheet" type="text/css" href="{{ $dark.Permalink | relURL }}" media="(prefers-color-scheme: dark)">
- {{ end }}
- {{ end }}
+ {{ $options := (dict "outputStyle" "compressed" "includePaths" (slice "sass")) }}
+ {{ $lightScss := resources.Get "css/hulga.scss" }}
+ {{ $darkScss := resources.Get "css/hulga-dark.scss" }}
+ {{ if .Site.Params.postcss }}
+ {{ $light := $lightScss | resources.ExecuteAsTemplate "css/hulga.scss" . | resources.ToCSS $options | postCSS | resources.Minify }}
+ <link rel="stylesheet" type="text/css" href="{{ $light.Permalink | relURL }}">
+ {{ if .Site.Params.darkMedia }}
+ {{ $dark := $darkScss | resources.ExecuteAsTemplate "css/hulga-dark.scss" . | resources.ToCSS $options | postCSS | resources.Minify }}
+ <link rel="stylesheet" type="text/css" href="{{ $dark.Permalink | relURL }}" media="(prefers-color-scheme: dark)">
+ {{ end }}
+ {{ else }}
+ {{ $light := $lightScss | resources.ExecuteAsTemplate "css/hulga.scss" . | resources.ToCSS $options | resources.Minify }}
+ <link rel="stylesheet" type="text/css" href="{{ $light.Permalink | relURL }}">
+ {{ if .Site.Params.darkMedia }}
+ {{ $dark := $darkScss | resources.ExecuteAsTemplate "css/hulga-dark.scss" . | resources.ToCSS $options | resources.Minify }}
+ <link rel="stylesheet" type="text/css" href="{{ $dark.Permalink | relURL }}" media="(prefers-color-scheme: dark)">
+ {{ end }}
+ {{ end }}
+ {{ if .Site.Params.pwa }}
+ <link rel="manifest" href="/manifest.json">
+ {{ end }}
-</head>
+</head> \ No newline at end of file
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
index cde1b5e..40337d1 100644
--- a/layouts/partials/nav.html
+++ b/layouts/partials/nav.html
@@ -1,8 +1,8 @@
<nav class="navbar is-primary">
<div class="container">
<div class="navbar-brand">
- <a class="navbar-item" href="/">
- {{.Site.Title}}
+ <a class="navbar-item {{if ne .Kind "page"}}fake-text{{end}}" href="/">
+ {{.Site.Title }}
</a>
<a role="button" class="navbar-burger" data-target="navMenu" aria-label="menu" aria-expanded="false">
<span aria-hidden="true"></span>
diff --git a/layouts/partials/paginator.html b/layouts/partials/paginator.html
index f311349..934596d 100644
--- a/layouts/partials/paginator.html
+++ b/layouts/partials/paginator.html
@@ -1,7 +1,7 @@
{{ $pag := .Paginate (where .Data.Pages "Type" "post") }}
{{ if gt $pag.TotalPages 1 -}}
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
- <a class="pagination-previous" {{ if $pag.HasPrev }} href="{{ $pag.Prev.URL }}" {{ else }} disabled {{ end }}>
+ <a class="pagination-previous" {{ if $pag.HasPrev }} href="{{ $pag.Prev.URL }}" {{ else }} href="#" disabled {{ end }}>
{{ i18n "prev_page"}}
</a>
<ul class="pagination-list">
@@ -29,7 +29,7 @@
{{- end -}}
{{- end }}
</ul>
- <a class="pagination-next" {{ if $pag.HasNext }} href="{{ $pag.Next.URL }}" {{ else }} disabled {{ end }}>
+ <a class="pagination-next" {{ if $pag.HasNext }} href="{{ $pag.Next.URL }}" {{ else }} href="#" disabled {{ end }}>
{{ i18n "next_page"}}
</a>
{{ end }}
diff --git a/layouts/partials/post-header.html b/layouts/partials/post-header.html
new file mode 100644
index 0000000..d156c78
--- /dev/null
+++ b/layouts/partials/post-header.html
@@ -0,0 +1,37 @@
+<section class="hero is-primary shadow-hero {{ if .Site.Params.heroBold}} is-bold {{ end }}">
+ <div class="hero-head">
+ {{ partial "nav.html" . }}
+ </div>
+ <div class="hero-body">
+ <header class="container has-text-centered">
+ <h1 class="title post-title">
+ {{ .Title }}
+ </h1>
+ <h2 class="subtitle">
+ {{- if isset .Params "date" -}}
+ <time class="post-meta">{{ .Date.Format "2006/01/02" }}</time>
+ {{- end -}}
+ {{ with .Params.Categories }} ・
+ {{ range .}}
+ <span class="post-tag post-meta">
+ <a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
+ </span>
+ {{ end }}
+ {{ end }}
+ {{- if eq .Type "archives" -}}
+ {{- $count := len (where (where .Site.Pages "Type" "post") "Kind" "page") -}}
+ {{ i18n "archives_count" (dict "Count" $count) }}
+ {{- end -}}
+ </h2>
+ {{ with .Params.tags }}
+ <div class="tagbox post-meta">
+ {{ range . }}
+ <span class="post-tag">
+ <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">#{{ . }}</a>
+ </span>
+ {{ end }}
+ </div>
+ {{ end }}
+ </header>
+ </div>
+</section> \ No newline at end of file
diff --git a/layouts/partials/post.html b/layouts/partials/post.html
index 80cf98d..5a8c2e6 100644
--- a/layouts/partials/post.html
+++ b/layouts/partials/post.html
@@ -1,48 +1,11 @@
-<section class="hero is-primary shadow-hero {{ if .Site.Params.heroBold}} is-bold {{ end }}">
- <div class="hero-head">
- {{ partial "nav.html" . }}
- </div>
- <div class="hero-body">
- {{ if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) }}
- <header class="container">
- {{ else }}
- <header class="container has-text-centered">
- {{ end }}
- <h1 class="title post-title">
- {{ .Title }}
- </h1>
- <h2 class="subtitle">
- {{- if isset .Params "date" -}}
- <time class="post-meta">{{ .Date.Format "2006/01/02" }}</time>
- {{- end -}}
- {{ with .Params.Categories }} ・
- {{ range .}}
- <span class="post-tag post-meta">
- <a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
- </span>
- {{ end }}
- {{ end }}
- </h2>
- {{ with .Params.tags }}
- <div class="tagbox post-meta">
- {{ range . }}
- <span class="post-tag">
- <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">#{{ . }}</a>
- </span>
- {{ end }}
- <!-- <span class="post-tag">#Hello</span><span class="post-tag">#Hello</span> -->
- </div>
- {{ end }}
- </header>
- </div>
-</section>
+{{ partial "post-header.html" . }}
<section class="section">
<div class="container">
<div class="columns">
{{ if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) }}
- <div class="column is-three-quarters">
+ <div class="column is-1 is-hidden-mobile"></div>
+ <div class="column is-8">
{{ else }}
- <!-- <div class="column is-1 is-hidden-mobile"></div> -->
<div class="column is-three-fifths is-offset-one-fifth">
{{ end }}
<article class="content" id="post-content">
diff --git a/layouts/partials/posts.html b/layouts/partials/posts.html
index 6b3aed5..e9bf35d 100644
--- a/layouts/partials/posts.html
+++ b/layouts/partials/posts.html
@@ -5,7 +5,7 @@
<div class="columns">
<div class="column is-8">
<div class="post-lists">
- {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }}
+ {{ $paginator := .Paginate (where (where .Site.Pages "Type" "post") "Kind" "page") }}
{{ range $paginator.Pages }}
<div class="box post-box">
{{ with .Params.Tags }}
@@ -74,7 +74,7 @@
<div class="control">
<div class="tags has-addons">
<a class="tag" href="{{ "/tags/" | relLangURL }}{{ .Name | urlize }}/">{{ .Name }}</a>
- <span class="tag">
+ <span class="tag counter-tag">
{{ .Count }}
</span>
</div>
diff --git a/layouts/partials/pwa.html b/layouts/partials/pwa.html
new file mode 100644
index 0000000..0884273
--- /dev/null
+++ b/layouts/partials/pwa.html
@@ -0,0 +1,3 @@
+{{ $pwafile := resources.Get "js/pwa.js" }}
+{{ $pwa := $pwafile | resources.ExecuteAsTemplate "js/pwa.js" . | resources.Minify }}
+<script src="{{ $pwa.Permalink | relURL }}"></script>