Browse Source

Move to base templates and blocks

As opposed to the old way of including header/footer partials in every template.

For some reason, /themes/<THEME>/layouts/taxonomies/tag.terms.html doesn't work as a block but the default terms template /themes/<THEME>/layouts/_default/terms.html does.
master
Adrian Short 7 years ago
parent
commit
8096748c7d
11 changed files with 51 additions and 46 deletions
  1. +4
    -0
      layouts/_default/baseof.html
  2. +7
    -6
      layouts/_default/list.html
  3. +3
    -2
      layouts/_default/single.html
  4. +9
    -0
      layouts/_default/terms.html
  5. +6
    -6
      layouts/aside/single.html
  6. +4
    -4
      layouts/image/single.html
  7. +2
    -2
      layouts/index.html
  8. +7
    -9
      layouts/post/single.html
  9. +4
    -4
      layouts/quote/single.html
  10. +0
    -8
      layouts/taxonomy/tag.terms.html
  11. +5
    -5
      layouts/video/single.html

+ 4
- 0
layouts/_default/baseof.html View File

@@ -0,0 +1,4 @@
{{ partial "header" . }}
{{ block "main" . }}
{{ end }}
{{ partial "footer" . }}

+ 7
- 6
layouts/_default/list.html View File

@@ -1,7 +1,8 @@
{{ partial "header" . }}
<h1>{{ .Title }}</h1>
{{ range .Paginator.Pages }}
{{ .Render "li" }}
{{ define "main" }}
<h1>{{ .Title }}</h1>
{{ range .Paginator.Pages }}
{{ .Render "li" }}
{{ end }}
{{ template "_internal/pagination.html" . }}
{{ end }}
{{ template "_internal/pagination.html" . }}
{{ partial "footer" . }}


+ 3
- 2
layouts/_default/single.html View File

@@ -1,2 +1,3 @@
<h2>Default single template</h2>
{{ .Content }}
{{ define "main" }}
{{ .Content }}
{{ end }}

+ 9
- 0
layouts/_default/terms.html View File

@@ -0,0 +1,9 @@
{{ define "main" }}
<h1>Default taxonomy terms template</h1>
<h1>{{ .Title }}</h1>
<ul class="tag-cloud">
{{ range $name, $taxonomy := .Site.Taxonomies.tags }}
<li><a href="{{ "/tags/" | relURL }}{{ $name | urlize }}/">{{ $name }}&nbsp;({{ $taxonomy.Count}})</a></li>
{{ end}}
</ul>
{{ end }}

+ 6
- 6
layouts/aside/single.html View File

@@ -1,6 +1,6 @@
{{ partial "header" . }}
<div id="aside-single">
{{ .Content }}
</div>
{{ partial "postmeta" . }}
{{ partial "footer" . }}
{{ define "main" }}
<div id="aside-single">
{{ .Content }}
</div>
{{ partial "postmeta" . }}
{{ end }}

+ 4
- 4
layouts/image/single.html View File

@@ -1,4 +1,4 @@
{{ partial "header" . }}
{{ partial "image" . }}
{{ partial "postmeta" . }}
{{ partial "footer" . }}
{{ define "main" }}
{{ partial "image" . }}
{{ partial "postmeta" . }}
{{ end }}

+ 2
- 2
layouts/index.html View File

@@ -1,6 +1,6 @@
{{ partial "header" . }}
{{ define "main" }}
{{ range .Paginator.Pages }}
{{ .Render "li" }}
{{ end }}
{{ template "_internal/pagination.html" . }}
{{ partial "footer" . }}
{{ end }}

+ 7
- 9
layouts/post/single.html View File

@@ -1,9 +1,7 @@
{{ partial "header" . }}

<article>
<h1>{{ .Title }}</h1>
{{ .Content }}
</article>

{{ partial "postmeta" . }}
{{ partial "footer" . }}
{{ define "main" }}
<article>
<h1>{{ .Title }}</h1>
{{ .Content }}
</article>
{{ partial "postmeta" . }}
{{ end }}

+ 4
- 4
layouts/quote/single.html View File

@@ -1,4 +1,4 @@
{{ partial "header" . }}
{{ partial "quote" . }}
{{ partial "postmeta" . }}
{{ partial "footer" . }}
{{ define "main" }}
{{ partial "quote" . }}
{{ partial "postmeta" . }}
{{ end }}

+ 0
- 8
layouts/taxonomy/tag.terms.html View File

@@ -1,8 +0,0 @@
{{ partial "header" . }}
<h1>{{ .Title }}</h1>
<ul class="tag-cloud">
{{ range $name, $taxonomy := .Site.Taxonomies.tags }}
<li><a href="{{ "/tags/" | relURL }}{{ $name | urlize }}/">{{ $name }}&nbsp;({{ $taxonomy.Count}})</a></li>
{{ end}}
</ul>
{{ partial "footer" . }}

+ 5
- 5
layouts/video/single.html View File

@@ -1,5 +1,5 @@
{{ partial "header" . }}
{{ partial "video-embed" .Params.embed_url }}
{{ .Content }}
{{ partial "postmeta" . }}
{{ partial "footer" . }}
{{ define "main" }}
{{ partial "video-embed" .Params.embed_url }}
{{ .Content }}
{{ partial "postmeta" . }}
{{ end }}

Loading…
Cancel
Save