1
0
mirror of https://github.com/alanorth/hugo-theme-bootstrap4-blog.git synced 2024-11-24 13:10:18 +01:00

Start using Go 1.6's blocks

Partials are nice, but blocks are a better base construct. Right
now there is basically only layouts/_default/baseof.html that is
doing most of the work.

See: https://gohugo.io/templates/blocks
This commit is contained in:
Alan Orth 2016-09-01 17:37:27 +03:00
parent 3042101003
commit 412cc18cf9
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
12 changed files with 76 additions and 92 deletions

View File

@ -0,0 +1,66 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{{ "<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->" | safeHTML }}
{{ if .Site.Params.description }}<meta name="description" content="{{ .Site.Params.description }}">{{ end }}
{{ if .Site.Params.author }}<meta name="author" content="{{ .Site.Params.author }}">{{ end }}
{{ .Hugo.Generator }}
<base href="{{ .Site.BaseURL }}">
<link rel="canonical" href="{{ .Permalink }}">
<title>{{ block "title" . }}{{ .Site.Title }}{{ end }}</title>
{{ "<!-- combined, minified CSS -->" | safeHTML }}
<link href="{{ .Site.BaseURL }}css/style.css" rel="stylesheet">
</head>
<body>
<div class="blog-masthead">
<div class="container">
<nav class="nav blog-nav">
<a class="nav-link" href="{{ .Site.BaseURL }}">Home</a>
</nav>
</div>
</div>
<div class="blog-header">
<div class="container">
<h1 class="blog-title">{{ .Site.Title | safeHTML }}</h1>
{{ if .Site.Params.description }}<p class="lead blog-description">{{ .Site.Params.description | safeHTML }}</p>{{ end }}
</div>
</div>
<div class="container">
<div class="row">
<div class="col-sm-8 blog-main">
{{ block "main" . }}
<!-- The part of the page that begins to differ between templates -->
{{ end }}
</div> {{ "<!-- /.blog-main -->" | safeHTML }}
{{ if not .Site.Params.sidebar.hide }}
{{ partial "sidebar.html" . }}
{{ end }}
</div> {{ "<!-- /.row -->" | safeHTML }}
</div> {{ "<!-- /.container -->" | safeHTML }}
<footer class="blog-footer">
<p>
Blog template built by <a href='https://twitter.com/mralanorth'>@mralanorth</a>.
</p>
</footer>
</body>
</html>

View File

@ -0,0 +1,7 @@
{{ define "main" }}
{{ range .Data.Pages }}
{{ .Render "summary"}}
{{ end }}
{{ end }}

View File

@ -1,16 +1,8 @@
<div class="container">
<div class="row">
<div class="col-sm-8 blog-main">
{{ define "title" }}{{ .Title }} &ndash; {{ .Site.Title }}{{ end }}
{{ define "main" }}
<article class="blog-post">
<h2 class="blog-post-title"><a href="{{ .Permalink }}" title="{{ .Title }}">{{ .Title }}</a></h2>
<p class="blog-post-meta"><time datetime="{{ .Date }}">{{ .Date.Format .Site.Params.date_format }}</time> by <a href="#">{{ .Params.author | default .Site.Params.author }}</a></p>
{{ .Content }}
</article> <!-- /.blog-post -->
</div> <!-- /.blog-main -->
{{ if not .Site.Params.sidebar.hide }}
{{ partial "sidebar.html" . }}
{{ end }}
</div> <!-- /.row -->
</div> <!-- /.container -->
{{ end }}

View File

@ -1,11 +0,0 @@
{{ partial "head.html" . }}
{{ partial "menu.html" . }}
{{ partial "header.html" . }}
{{ partial "content-summary.html" . }}
{{ partial "footer.html" . }}
{{ partial "after-footer.html" . }}

View File

@ -1,3 +0,0 @@
</body>
</html>

View File

@ -1,14 +0,0 @@
<div class="container">
<div class="row">
<div class="col-sm-8 blog-main">
{{ range .Data.Pages }}
{{ .Render "summary"}}
{{ end }}
</div> <!-- /.blog-main -->
{{ if not .Site.Params.sidebar.hide }}
{{ partial "sidebar.html" . }}
{{ end }}
</div> <!-- /.row -->
</div> <!-- /.container -->

View File

@ -1,5 +0,0 @@
<footer class="blog-footer">
<p>
Blog template built by <a href='https://twitter.com/mralanorth'>@mralanorth</a>.
</p>
</footer>

View File

@ -1,24 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
{{ if .Site.Params.description }}<meta name="description" content="{{ .Site.Params.description }}">{{ end }}
{{ if .Site.Params.author }}<meta name="author" content="{{ .Site.Params.author }}">{{ end }}
{{ .Hugo.Generator }}
<base href="{{ .Site.BaseURL }}">
<link rel="canonical" href="{{ .Permalink }}">
<title>{{ .Title }}</title>
<!-- combined, minified CSS -->
<link href="{{ .Site.BaseURL }}css/style.css" rel="stylesheet">
</head>
<body>

View File

@ -1,6 +0,0 @@
<div class="blog-header">
<div class="container">
<h1 class="blog-title">{{ .Site.Title | safeHTML }}</h1>
{{ if .Site.Params.description }}<p class="lead blog-description">{{ .Site.Params.description | safeHTML }}</p>{{ end }}
</div>
</div>

View File

@ -1,7 +0,0 @@
<div class="blog-masthead">
<div class="container">
<nav class="nav blog-nav">
<a class="nav-link" href="{{ .Site.BaseURL }}">Home</a>
</nav>
</div>
</div>

View File

@ -1,11 +0,0 @@
{{ partial "head.html" . }}
{{ partial "menu.html" . }}
{{ partial "header.html" . }}
{{ partial "content.html" . }}
{{ partial "footer.html" . }}
{{ partial "after-footer.html" . }}