Move majority of semantic tags to baseof.html #1

Merged
kevin merged 1 commits from semantics into master 2019-11-21 04:52:02 +00:00
8 changed files with 105 additions and 91 deletions

View File

@ -4,22 +4,44 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ block "title" . }}
<title>{{- block "title" . -}}
{{ .Site.Title }}
{{ end }}</title>
{{- end -}}</title>
</head>
<body>
<header>
{{- block "site-header" . -}}
<!-- Code that all your templates share, like a header -->
{{ partial "header.html" . }}
{{ block "main" . }}
{{- end }}
<nav>
{{ block "site-menu" . -}}
{{ partial "site-menu.html" . }}
{{- end }}
</nav>
</header>
<main>
<header>
{{- block "content-header" . -}}
{{- end -}}
<nav>
{{- block "content-menu" . -}}
{{- end -}}
</nav>
</header>
<section>
{{- block "content" . -}}
<!-- The part of the page that begins to differ between templates -->
{{ end }}
{{ block "footer" . }}
</section>
</main>
<footer>
{{- block "footer" . -}}
<!-- More shared code, perhaps a footer but that can be overridden if need be in -->
{{ partial "footer.html" . }}
{{ end }}
{{- partial "footer.html" . -}}
{{- end -}}
</footer>
</body>
</html>

View File

@ -2,18 +2,14 @@
{{ define "title" }}
{{ .Title }} &ndash; {{ .Site.Title }}
{{ end }}
{{ define "main" }}
<main>
<div>
<h1 id="title">{{ .Title }}</h1>
<div class="list-content">
{{ .Content }}
</div>
<div class="list-summary">
{{ range .Pages }}
{{ .Render "summary"}}
{{ end }}
</div>
</div>
</main>
{{ define "content-header" }}
<h1 id="title">{{ .Title }}</h1>
{{ end }}
{{ define "content" }}
<header class="list-content">
{{ .Content }}
</header>
{{ range .Pages }}
{{ .Render "summary"}}
{{ end }}
{{ end }}

View File

@ -2,9 +2,11 @@
{{ define "title" }}
{{ .Title }} &ndash; {{ .Site.Title }}
{{ end }}
{{ define "main" }}
<main>
<h1>{{ .Title }}</h1>
{{ .Content }}
</main>
{{ define "content-header" }}
<h1>{{ .Title }}</h1>
{{ end }}
{{ define "content" }}
<article>
{{ .Content }}
</article>
{{ end }}

View File

@ -3,12 +3,14 @@
<h2><a href='{{ .Permalink }}'>{{ .Title }}</a> </h2>
<div class="post-meta">{{ .Date.Format "Mon, Jan 2, 2006" }} - {{ .FuzzyWordCount }} Words </div>
</header>
<section>
{{ .Summary }}
{{ if .Truncated }}
</section>
{{- if .Truncated }}
<footer>
<a href='{{ .Permalink }}'>
<span style="white-space: nowrap;">Read more →</span>
</a>
</footer>
{{ end }}
{{- end }}
</article>

View File

@ -1,22 +1,20 @@
{{ define "main" }}
<main>
<header class="homepage-header">
{{- define "content-header" -}}
<hgroup>
<h1>{{.Title}}</h1>
{{ if .Params.Subtitle }}
<span class="subtitle">{{.Params.Subtitle}}</span>
{{ else if .Site.Params.Subtitle }}
<span class="subtitle">{{.Site.Params.Subtitle}}</span>
{{ end }}
</header>
<div class="homepage-content">
{{- if .Params.Subtitle }}
<h2 class="subtitle">{{.Params.Subtitle}}</h2>
{{- else if .Site.Params.Subtitle }}
<h2 class="subtitle">{{.Site.Params.Subtitle}}</h2>
{{- end }}
</hgroup>
{{ end }}
{{ define "content" }}
<article 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>
</article>
<!-- Note that .Pages is the same as .Site.RegularPages on the homepage template. -->
{{ range first 10 .Pages }}
{{ .Render "summary"}}
{{ end }}
{{ end }}

View File

@ -1,5 +1,3 @@
<footer>
{{ with .Site.Copyright }}
<p class="copyright">{{ . | markdownify }}</p>
{{ end }}
</footer>
{{ with .Site.Copyright }}
<p class="copyright">{{ . | markdownify }}</p>
{{ end }}

View File

@ -1,31 +0,0 @@
<header>
<nav>
<ul>
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
{{ if .HasChildren }}
<li class="{{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}">
<a href="#">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
<ul class="sub-menu">
{{ range .Children }}
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
{{ else }}
<li>
<a href="{{ .URL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
{{ end }}
{{ end }}
</ul>
</nav>
</header>

View File

@ -0,0 +1,27 @@
<ul>
{{- $currentPage := . -}}
{{- range .Site.Menus.main -}}
{{- if .HasChildren -}}
<li class="{{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}">
<a href="#">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
<ul class="sub-menu">
{{ range .Children }}
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
<a href="{{ .URL }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
{{ else }}
<li>
<a href="{{ .URL }}">
{{ .Pre }}
<span>{{ .Name }}</span>
</a>
</li>
{{- end -}}
{{ end }}
</ul>