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

github.com/vimux/blank.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvimux <vimux@protonmail.com>2019-07-31 00:32:26 +0300
committervimux <vimux@protonmail.com>2019-07-31 15:49:20 +0300
commitc8bf719e3d4a4c6ed1e70c5091f72e542ffc7a3d (patch)
treed81f0d69cedfc20638d42e88b19b08f23d8632da
parentc71d33abd2c051c19c6298f150277c9dbdbe2bcd (diff)
Define the Base Template and fix Hugo warnings
* Define the Base Template (baseof.html) * Use relative URL link to style.css file * Move summary.html from partials to _default layouts * Fix Hugo warnings (needs Hugo 0.20 or newer) * Fix Paginator rule on main page. Fix #8 * Latest posts: show pages from mainSections only * Bump Hugo 0.19 -> 0.20 * Formatting
-rw-r--r--layouts/_default/baseof.html20
-rw-r--r--layouts/_default/list.html16
-rw-r--r--layouts/_default/single.html6
-rw-r--r--layouts/_default/summary.html13
-rw-r--r--layouts/index.html8
-rw-r--r--layouts/partials/footer.html8
-rw-r--r--layouts/partials/header.html34
-rw-r--r--layouts/partials/sidebar.html24
-rw-r--r--layouts/partials/summary.html13
-rw-r--r--theme.toml2
10 files changed, 77 insertions, 67 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
new file mode 100644
index 0000000..33e5cda
--- /dev/null
+++ b/layouts/_default/baseof.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="{{ .Site.LanguageCode | default "en-us" }}">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <title>{{ .Title }}</title>
+ {{ with .Site.Params.description }}<meta name="description" content="{{ . }}">{{ end }}
+ {{ with .Site.Params.author }}<meta name="author" content="{{ . }}">{{ end }}
+ <link rel="stylesheet" href="{{ "css/style.css" | relURL }}">
+ {{ with .OutputFormats.Get "RSS" -}}
+ {{ printf `<link rel="%s" type="%s" href="%s" title="%s">` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }}
+ {{- end }}
+</head>
+<body>
+ {{ partial "header" . }}
+ {{ block "main" . }}{{ end }}
+ {{ partial "footer" . }}
+</body>
+</html>
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index bc7f4e6..68fb00c 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -1,10 +1,16 @@
-{{ partial "header.html" . }}
+{{ define "main" }}
<main>
- {{ $paginator := .Paginate (where .Data.Pages "Type" "post") }}
- {{ range $paginator.Pages }}
- {{ partial "summary.html" . }}
+ {{ if or .Title .Content }}
+ <div>
+ {{ with .Title }}<h1>{{ . }}</h1>{{ end }}
+ {{ with .Content }}<div>{{ . }}</div>{{ end }}
+ </div>
+ {{ end }}
+
+ {{ range .Paginator.Pages }}
+ {{ .Render "summary" }}
{{ end }}
{{ partial "pagination.html" . }}
</main>
{{ partial "sidebar.html" . }}
-{{ partial "footer.html" . }}
+{{ end }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 4593944..af8398c 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -1,4 +1,4 @@
-{{ partial "header.html" . }}
+{{ define "main" }}
<main>
<article>
<h1>{{ .Title }}</h1>
@@ -9,7 +9,7 @@
<div>
<ul id="tags">
{{ range .Params.tags }}
- <li><a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a> </li>
+ <li><a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a></li>
{{ end }}
</ul>
</div>
@@ -19,4 +19,4 @@
</article>
</main>
{{ partial "sidebar.html" . }}
-{{ partial "footer.html" . }}
+{{ end }}
diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html
new file mode 100644
index 0000000..9acf434
--- /dev/null
+++ b/layouts/_default/summary.html
@@ -0,0 +1,13 @@
+<article>
+ <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
+ <time>{{ .Date.Format "02.01.2006 15:04" }}</time>
+ {{ range .Params.tags }}
+ <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
+ {{ end }}
+ <div>
+ {{ .Summary }}
+ {{ if .Truncated }}
+ <a href="{{ .Permalink }}">Read more...</a>
+ {{ end }}
+ </div>
+</article>
diff --git a/layouts/index.html b/layouts/index.html
index 56c41f3..ab01f67 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -1,10 +1,10 @@
-{{ partial "header.html" . }}
+{{ define "main" }}
<main>
- {{ $paginator := .Paginate (where .Site.Pages "Type" "post") }}
+ {{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
{{ range $paginator.Pages }}
- {{ partial "summary.html" . }}
+ {{ .Render "summary" }}
{{ end }}
{{ partial "pagination.html" . }}
</main>
{{ partial "sidebar.html" . }}
-{{ partial "footer.html" . }}
+{{ end }}
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 6551e25..a34c170 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,5 +1,3 @@
- <footer>
- <p>&copy; {{ now.Year }} <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></p>
- </footer>
-</body>
-</html>
+<footer>
+ <p>&copy; {{ now.Year }} <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></p>
+</footer>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 9a9179c..86e0e27 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,24 +1,10 @@
-<!DOCTYPE html>
-<html lang="{{ .Site.LanguageCode | default "en-us" }}">
-<head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <title>{{ .Title }}</title>
- {{ with .Site.Params.description }}<meta name="description" content="{{ . }}">{{ end }}
- {{ with .Site.Params.author }}<meta name="author" content="{{ . }}">{{ end }}
- <link rel="stylesheet" href="{{ .Site.BaseURL }}css/style.css">
- {{ if .RSSLink -}}<link href="{{ .RSSLink }}" rel="feed" type="application/rss+xml" title="{{ .Site.Title }}">{{- end }}
- {{ .Hugo.Generator }}
-</head>
-<body>
- <header>
- <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
- <nav>
- <ul>
- {{ range .Site.Menus.main }}
- <li><a href="{{ .URL | relURL }}">{{ .Name }}</a></li>
- {{ end }}
- </ul>
- </nav>
- </header>
+<header>
+ <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
+ <nav>
+ <ul>
+ {{ range .Site.Menus.main }}
+ <li><a href="{{ .URL | relURL }}">{{ .Name }}</a></li>
+ {{ end }}
+ </ul>
+ </nav>
+</header>
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html
index 679b16e..92bbd80 100644
--- a/layouts/partials/sidebar.html
+++ b/layouts/partials/sidebar.html
@@ -1,14 +1,14 @@
- <aside>
+<aside>
+ <div>
<div>
- <div>
- <h3>LATEST POSTS</h3>
- </div>
- <div>
- <ul>
- {{ range first 5 .Site.Pages }}
- <li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
- {{ end }}
- </ul>
- </div>
+ <h3>LATEST POSTS</h3>
</div>
- </aside>
+ <div>
+ <ul>
+ {{ range first 5 (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
+ <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
+ {{ end }}
+ </ul>
+ </div>
+ </div>
+</aside>
diff --git a/layouts/partials/summary.html b/layouts/partials/summary.html
deleted file mode 100644
index aadf63b..0000000
--- a/layouts/partials/summary.html
+++ /dev/null
@@ -1,13 +0,0 @@
- <article>
- <h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
- <time>{{ .Date.Format "02.01.2006 15:04" }}</time>
- {{ range .Params.tags }}
- <a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
- {{ end }}
- <div>
- {{ .Summary }}
- {{ if .Truncated }}
- <a href="{{ .Permalink }}">Read more...</a>
- {{ end }}
- </div>
- </article>
diff --git a/theme.toml b/theme.toml
index 15f0f63..559d2c6 100644
--- a/theme.toml
+++ b/theme.toml
@@ -5,7 +5,7 @@ description = "Starter Hugo theme for developers."
homepage = "https://github.com/vimux/blank/"
tags = ["blog", "plain", "blank", "starter"]
features = ["blog"]
-min_version = 0.19
+min_version = 0.20
[author]
name = "Vimux"