Browse Source

Major refactor of layouts to remove duplication

main
Jez Cope 4 months ago
parent
commit
444defc10d
  1. 6
      assets/style/main.sass
  2. 2
      layouts/_default/frag/metadata.html
  3. 4
      layouts/_default/frag/summary-content.html
  4. 1
      layouts/_default/frag/title.html
  5. 10
      layouts/_default/single.html
  6. 23
      layouts/_default/summary.html
  7. 2
      layouts/index.html
  8. 4
      layouts/link/frag/summary-content.html
  9. 21
      layouts/link/summary.html
  10. 1
      layouts/note/frag/summary-content.html
  11. 15
      layouts/note/summary.html
  12. 1
      layouts/page/frag/metadata.html
  13. 1
      layouts/page/frag/title.html
  14. 26
      layouts/page/single.html
  15. 2
      layouts/partials/footer.html
  16. 1
      layouts/post/frag/title.html

6
assets/style/main.sass

@ -100,6 +100,12 @@ h6, .content h6
@extend .px-3
@extend .py-5
.link-summary
@extend .has-background-link-light
.note-summary
@extend .has-background-info-light
.single
@extend .my-5
@extend .px-3

2
layouts/_default/frag/metadata.html

@ -0,0 +1,2 @@
<time>{{ .Date.Format .Site.Params.DateFormat }}</time>
{{ partial "tags.html" .Params.tags }}

4
layouts/_default/frag/summary-content.html

@ -0,0 +1,4 @@
{{ .Summary }}
{{ if .Truncated }}
<a href="{{ .RelPermalink }}">Read more...</a>
{{ end }}

1
layouts/_default/frag/title.html

@ -0,0 +1 @@
[{{ .Type | upper }}] {{ .Title }}

10
layouts/_default/single.html

@ -4,16 +4,12 @@
<div class="container">
<div class="columns">
<div class="column is-8 is-offset-2">
<h1>
{{ if ne .Type "posts" }}[{{ .Type | upper }}]{{ end }}
{{ .Title }}
</h1>
<h1>{{ .Render "frag/title" }}</h1>
</div>
</div>
<div class="columns">
<div class="column is-2">
<time>{{ .Date.Format .Site.Params.DateFormat }}</time>
{{ partial "tags.html" .Params.tags }}
{{ .Render "frag/metadata" }}
</div>
<div class="column is-8">
<div class="content">
@ -21,7 +17,7 @@
</div>
</div>
</div>
{{ partial "comments.html" . }}
{{ partial "comments" . }}
</div>
</article>
</main>

23
layouts/_default/summary.html

@ -1,20 +1,19 @@
<article class="summary">
<article class="summary {{ .Type }}-summary">
<div class="container">
<div class="columns">
<div class="column is-8 is-offset-2">
<h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h1>
{{ if ne .Type "note" }}
<div class="columns">
<div class="column is-8 is-offset-2">
<h2><a href="{{ with .Params.link }}{{.}}{{ else }}{{ .RelPermalink }}{{ end }}">
{{ .Render "frag/title" }}</a></h2>
</div>
</div>
</div>
{{ end }}
<div class="columns">
<div class="column is-2">
<time>{{ .Date.Format .Site.Params.DateFormat }}</time>
{{ partial "tags.html" .Params.tags }}
{{ .Render "frag/metadata" }}
</div>
<div class="column is-8">
{{ .Summary }}
{{ if .Truncated }}
<a href="{{ .RelPermalink }}">Read more...</a>
{{ end }}
<div class="column is-8 content">
{{ .Render "frag/summary-content" }}
</div>
</div>
</div>

2
layouts/index.html

@ -17,6 +17,6 @@
{{ range $paginator.Pages }}
{{ .Render "summary" }}
{{ end }}
{{ partial "pagination.html" . }}
{{ partial "pagination" . }}
</main>
{{ end }}

4
layouts/link/frag/summary-content.html

@ -0,0 +1,4 @@
{{ .Content }}
<p>
<a href="{{ .Params.link }}">&gt;&gt;&gt;</a>
</p>

21
layouts/link/summary.html

@ -1,21 +0,0 @@
<article class="summary link has-background-link-light">
<div class="container">
<div class="columns">
<div class="column is-8 is-offset-2">
<h2><a href="{{ .Params.link }}">[LINK] {{ .Title }}</a></h2>
</div>
</div>
<div class="columns">
<div class="column is-2">
<time>{{ .Date.Format .Site.Params.DateFormat }}</time>
{{ partial "tags.html" .Params.tags }}
</div>
<div class="column is-8 content">
{{ .Content }}
<p>
<a href="{{ .Params.link }}">&gt;&gt;&gt;</a>
</p>
</div>
</div>
</div>
</article>

1
layouts/note/frag/summary-content.html

@ -0,0 +1 @@
{{ .Content }}

15
layouts/note/summary.html

@ -1,15 +0,0 @@
<article class="summary note has-background-info-light">
<div class="container">
<div class="columns">
<div class="column is-2">
<time>{{ .Date.Format .Site.Params.DateFormat }}</time>
{{ partial "tags.html" .Params.tags }}
</div>
<div class="column is-8">
<div class="content">
{{ .Content }}
</div>
</div>
</div>
</div>
</article>

1
layouts/page/frag/metadata.html

@ -0,0 +1 @@
{{ partial "tags" .Params.tags }}

1
layouts/page/frag/title.html

@ -0,0 +1 @@
{{ .Title }}

26
layouts/page/single.html

@ -1,26 +0,0 @@
{{ define "main" }}
<main>
<article class="single">
<div class="container">
<div class="columns">
<div class="column is-8 is-offset-2">
<h1>
{{ .Title }}
</h1>
</div>
</div>
<div class="columns">
<div class="column is-2">
{{ partial "tags.html" .Params.tags }}
</div>
<div class="column is-8">
<div class="content">
{{ .Content }}
</div>
</div>
</div>
{{ partial "comments.html" . }}
</div>
</article>
</main>
{{ end }}

2
layouts/partials/footer.html

@ -2,7 +2,7 @@
<div class="container">
<div class="columns">
<footer class="column is-8 is-offset-2 has-text-centered">
{{ partial "social.html" . }}
{{ partial "social" . }}
<p>
&copy; {{ now.Year }}
<a href="{{ .Site.BaseURL }}">{{ .Site.Params.Author }}</a>

1
layouts/post/frag/title.html

@ -0,0 +1 @@
{{ .Title }}
Loading…
Cancel
Save