Create basic layout structure
Create basic layout structure by following along with the documentation from gohugo.io. In particular: * Basic Templates and Blocks (https://gohugo.io/templates/base/) * Content View Templates (https://gohugo.io/templates/views/) * Homepage Template (https://gohugo.io/templates/homepage/)master
parent
75cf6c1118
commit
e3b6780603
|
@ -1,11 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
{{- partial "head.html" . -}}
|
||||
<body>
|
||||
{{- partial "header.html" . -}}
|
||||
<div id="content">
|
||||
{{- block "main" . }}{{- end }}
|
||||
</div>
|
||||
{{- partial "footer.html" . -}}
|
||||
</body>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{ block "title" . }}
|
||||
{{ .Site.Title }}
|
||||
{{ end }}</title>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Code that all your templates share, like a header -->
|
||||
{{ partial "header.html" . }}
|
||||
{{ block "main" . }}
|
||||
<!-- The part of the page that begins to differ between templates -->
|
||||
{{ end }}
|
||||
{{ block "footer" . }}
|
||||
<!-- More shared code, perhaps a footer but that can be overridden if need be in -->
|
||||
{{ partial "footer.html" . }}
|
||||
{{ end }}
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -0,0 +1,14 @@
|
|||
{{/* This will override the default value set in baseof.html; i.e., "{{.Site.Title}}" in the original example */}}
|
||||
{{ define "title" }}
|
||||
{{ .Title }} – {{ .Site.Title }}
|
||||
{{ end }}
|
||||
{{ define "main" }}
|
||||
<main>
|
||||
<div>
|
||||
<h1 id="title">{{ .Title }}</h1>
|
||||
{{ range .Pages }}
|
||||
{{ .Render "summary"}}
|
||||
{{ end }}
|
||||
</div>
|
||||
</main>
|
||||
{{ end }}
|
|
@ -0,0 +1,10 @@
|
|||
{{/* This will override the default value set in baseof.html; i.e., "{{.Site.Title}}" in the original example */}}
|
||||
{{ define "title" }}
|
||||
{{ .Title }} – {{ .Site.Title }}
|
||||
{{ end }}
|
||||
{{ define "main" }}
|
||||
<main>
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ .Content }}
|
||||
</main>
|
||||
{{ end }}
|
|
@ -0,0 +1,12 @@
|
|||
<article class="post">
|
||||
<header>
|
||||
<h2><a href='{{ .Permalink }}'>{{ .Title }}</a> </h2>
|
||||
<div class="post-meta">{{ .Date.Format "Mon, Jan 2, 2006" }} - {{ .FuzzyWordCount }} Words </div>
|
||||
</header>
|
||||
{{ .Summary }}
|
||||
<footer>
|
||||
<a href='{{ .Permalink }}'>
|
||||
<span style="white-space: nowrap;">Read more →</span>
|
||||
</a>
|
||||
</footer>
|
||||
</article>
|
|
@ -0,0 +1,20 @@
|
|||
{{ define "main" }}
|
||||
<main>
|
||||
<header class="homepage-header">
|
||||
<h1>{{.Title}}</h1>
|
||||
{{ with .Site.Params.Subtitle }}
|
||||
<span class="subtitle">{{.}}</span>
|
||||
{{ end }}
|
||||
</header>
|
||||
<div class="homepage-content">
|
||||
<!-- Note that the content for index.html, as a sort of list page, will pull from content/_index.md -->
|
||||
{{.Content}}
|
||||
</div>
|
||||
<div>
|
||||
<!-- Note that .Pages is the same as .Site.RegularPages on the homepage template. -->
|
||||
{{ range first 10 .Pages }}
|
||||
{{ .Render "summary"}}
|
||||
{{ end }}
|
||||
</div>
|
||||
</main>
|
||||
{{ end }}
|
|
@ -0,0 +1,5 @@
|
|||
<footer>
|
||||
{{ with .Site.Copyright }}
|
||||
<p class="copyright">{{ . | markdownify }}</p>
|
||||
{{ end }}
|
||||
</footer>
|
|
@ -0,0 +1,2 @@
|
|||
<header>
|
||||
</header>
|
Loading…
Reference in New Issue