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

View File

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

View File

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

View File

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

View File

@ -1,22 +1,20 @@
{{ define "main" }} {{- define "content-header" -}}
<main> <hgroup>
<header class="homepage-header"> <h1>{{.Title}}</h1>
<h1>{{.Title}}</h1> {{- if .Params.Subtitle }}
{{ if .Params.Subtitle }} <h2 class="subtitle">{{.Params.Subtitle}}</h2>
<span class="subtitle">{{.Params.Subtitle}}</span> {{- else if .Site.Params.Subtitle }}
{{ else if .Site.Params.Subtitle }} <h2 class="subtitle">{{.Site.Params.Subtitle}}</h2>
<span class="subtitle">{{.Site.Params.Subtitle}}</span> {{- end }}
{{ end }} </hgroup>
</header> {{ end }}
<div class="homepage-content"> {{ define "content" }}
<!-- Note that the content for index.html, as a sort of list page, will pull from content/_index.md --> <article class="homepage-content">
{{.Content}} <!-- Note that the content for index.html, as a sort of list page, will pull from content/_index.md -->
</div> {{.Content}}
<div> </article>
<!-- Note that .Pages is the same as .Site.RegularPages on the homepage template. --> <!-- Note that .Pages is the same as .Site.RegularPages on the homepage template. -->
{{ range first 10 .Pages }} {{ range first 10 .Pages }}
{{ .Render "summary"}} {{ .Render "summary"}}
{{ end }} {{ end }}
</div>
</main>
{{ end }} {{ end }}

View File

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

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>