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
This commit is contained in:
parent
c71d33abd2
commit
c8bf719e3d
10 changed files with 77 additions and 67 deletions
20
layouts/_default/baseof.html
Normal file
20
layouts/_default/baseof.html
Normal file
|
@ -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>
|
|
@ -1,10 +1,16 @@
|
||||||
{{ partial "header.html" . }}
|
{{ define "main" }}
|
||||||
<main>
|
<main>
|
||||||
{{ $paginator := .Paginate (where .Data.Pages "Type" "post") }}
|
{{ if or .Title .Content }}
|
||||||
{{ range $paginator.Pages }}
|
<div>
|
||||||
{{ partial "summary.html" . }}
|
{{ with .Title }}<h1>{{ . }}</h1>{{ end }}
|
||||||
|
{{ with .Content }}<div>{{ . }}</div>{{ end }}
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ range .Paginator.Pages }}
|
||||||
|
{{ .Render "summary" }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ partial "pagination.html" . }}
|
{{ partial "pagination.html" . }}
|
||||||
</main>
|
</main>
|
||||||
{{ partial "sidebar.html" . }}
|
{{ partial "sidebar.html" . }}
|
||||||
{{ partial "footer.html" . }}
|
{{ end }}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{ partial "header.html" . }}
|
{{ define "main" }}
|
||||||
<main>
|
<main>
|
||||||
<article>
|
<article>
|
||||||
<h1>{{ .Title }}</h1>
|
<h1>{{ .Title }}</h1>
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
<div>
|
<div>
|
||||||
<ul id="tags">
|
<ul id="tags">
|
||||||
{{ range .Params.tags }}
|
{{ range .Params.tags }}
|
||||||
<li><a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a> </li>
|
<li><a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -19,4 +19,4 @@
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
{{ partial "sidebar.html" . }}
|
{{ partial "sidebar.html" . }}
|
||||||
{{ partial "footer.html" . }}
|
{{ end }}
|
||||||
|
|
13
layouts/_default/summary.html
Normal file
13
layouts/_default/summary.html
Normal file
|
@ -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>
|
|
@ -1,10 +1,10 @@
|
||||||
{{ partial "header.html" . }}
|
{{ define "main" }}
|
||||||
<main>
|
<main>
|
||||||
{{ $paginator := .Paginate (where .Site.Pages "Type" "post") }}
|
{{ $paginator := .Paginate (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
|
||||||
{{ range $paginator.Pages }}
|
{{ range $paginator.Pages }}
|
||||||
{{ partial "summary.html" . }}
|
{{ .Render "summary" }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ partial "pagination.html" . }}
|
{{ partial "pagination.html" . }}
|
||||||
</main>
|
</main>
|
||||||
{{ partial "sidebar.html" . }}
|
{{ partial "sidebar.html" . }}
|
||||||
{{ partial "footer.html" . }}
|
{{ end }}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
<footer>
|
<footer>
|
||||||
<p>© {{ now.Year }} <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></p>
|
<p>© {{ now.Year }} <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></p>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
|
@ -1,18 +1,4 @@
|
||||||
<!DOCTYPE html>
|
<header>
|
||||||
<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>
|
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -21,4 +7,4 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
<aside>
|
<aside>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<h3>LATEST POSTS</h3>
|
<h3>LATEST POSTS</h3>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<ul>
|
<ul>
|
||||||
{{ range first 5 .Site.Pages }}
|
{{ range first 5 (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
|
||||||
<li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
|
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
|
@ -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>
|
|
|
@ -5,7 +5,7 @@ description = "Starter Hugo theme for developers."
|
||||||
homepage = "https://github.com/vimux/blank/"
|
homepage = "https://github.com/vimux/blank/"
|
||||||
tags = ["blog", "plain", "blank", "starter"]
|
tags = ["blog", "plain", "blank", "starter"]
|
||||||
features = ["blog"]
|
features = ["blog"]
|
||||||
min_version = 0.19
|
min_version = 0.20
|
||||||
|
|
||||||
[author]
|
[author]
|
||||||
name = "Vimux"
|
name = "Vimux"
|
||||||
|
|
Loading…
Reference in a new issue