diff options
author | Fabian Tamp <fabian.tamp@gmail.com> | 2020-08-18 22:14:15 +0300 |
---|---|---|
committer | Fabian Tamp <fabian.tamp@gmail.com> | 2020-08-18 23:16:30 +0300 |
commit | a276dcdce94d64c02484759162272cabf475ff2c (patch) | |
tree | 2b7dc136f4aac649590a82f4dfa8413b5bc874f0 | |
parent | 91a8496b97145a4ef1d4deeb75125bdc3740700f (diff) |
Use baseof for template foundation
WIP
-rw-r--r-- | layouts/_default/baseof.html | 35 | ||||
-rw-r--r-- | layouts/_default/list.html | 9 | ||||
-rw-r--r-- | layouts/_default/single.html | 71 | ||||
-rw-r--r-- | layouts/index.html | 51 | ||||
-rw-r--r-- | layouts/partials/head.html | 0 | ||||
-rw-r--r-- | layouts/partials/header.html | 27 | ||||
-rw-r--r-- | layouts/posts/single.html | 129 | ||||
-rw-r--r-- | layouts/taxonomy/taxonomy.html | 58 | ||||
-rw-r--r-- | layouts/taxonomy/terms.html | 68 |
9 files changed, 209 insertions, 239 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index f32d502..82f2ca7 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,9 +1,32 @@ <!DOCTYPE html> -<html> - {{- partial "head.html" . -}} - <body> - {{- partial "header.html" . -}} - <div id="content">{{- block "main" . }}{{ -end }}</div> - {{- partial "footer.html" . -}} +<html + lang="{{ .Site.LanguageCode }}" + prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#" +> + <head> + <meta charset="utf-8" /> + + {{ partial "meta.html" . }} + + <title>{{ .Title }}{{ if ne $.Site.Title .Title }} || {{ $.Site.Title }}{{ end }}</title> + <link rel="canonical" href="{{ .Permalink }}" /> + + {{ with .Site.Params.RSSCanonicalLink }} + <link rel="alternate" type="application/rss+xml" href="{{ . | absURL }}" title="{{$.Site.Title}}" /> + {{ else }} + {{- with .OutputFormats.Get "rss" -}} + {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} + {{- end -}} + {{ end }} + + {{ partial "head_includes.html" . }} + <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> + <link rel="apple-touch-icon" href="/apple-touch-icon.png" /> + </head> + <body + class="{{ block "body-classes" . }}{{ end }}" + lang="{{ .Site.LanguageCode }}"> + {{ block "content" . }}{{ end }} + {{ partial "footer.html" . }} </body> </html> diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 0415dd0..7c60a4e 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,6 +1,4 @@ -{{ partial "header.html" . }} -<body - lang="{{ .Site.LanguageCode }}" > +{{ define "content" }} <div class="nav-bkg"> <nav class="content-container pagewide-bar-padding"> <span class="divider">/ </span> @@ -30,7 +28,4 @@ </ul> </div> </section> - - {{ partial "footer.html" . }} - </body> -</html> +{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 574f79c..dc3e4cd 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,40 +1,35 @@ -{{ partial "header.html" . }} -<body - class="{{ if .Draft }}draft{{ end }} look-sheet-bkg" - lang="{{ .Site.LanguageCode }}" - itemscope - itemtype="http://schema.org/Article"> +{{ define "body-classes" -}} +look-sheet-bkg +{{- end }} +{{ define "content" }} +<div class="nav-bkg"> + <nav class="content-container pagewide-bar-padding"> + <span class="divider">/ </span> + <a href="{{ .Site.BaseURL }}" >{{ .Site.Title }}</a> + {{- if not .Parent.IsHome -}} + <span class="divider">/ </span> + <a href="{{ .Site.BaseURL }}{{ .CurrentSection.Type }}">{{.CurrentSection.Name}}</a> + {{- end -}} + {{ partial "right-links" . }} + </nav> +</div> - <div class="nav-bkg"> - <nav class="content-container pagewide-bar-padding"> - <span class="divider">/ </span> - <a href="{{ .Site.BaseURL }}" >{{ .Site.Title }}</a> - {{- if not .Parent.IsHome -}} - <span class="divider">/ </span> - <a href="{{ .Site.BaseURL }}{{ .CurrentSection.Type }}">{{.CurrentSection.Name}}</a> - {{- end -}} - {{ partial "right-links" . }} - </nav> - </div> - - <section id="main" class="content-container look-sheet article-pad-v {{ if (or .Params.disableMarginNotes .Site.Params.disableMarginNotes) }}no-floating-footnotes{{ end }}" itemprop="mainEntityOfPage"> - <h1 itemprop="name" id="title">{{ .Title }}</h1> - {{ if .Date }} - {{ if eq .Lastmod .Date }} - <div class="post-date"><span itemprop="datePublished">{{ .Date.Format "January 2, 2006" }}</span></div> - <meta itemprop="dateModified" content="{{ .Lastmod.Format "January 2, 2006" }}"/> - {{ else }} - <div class="post-date">Created: <span itemprop="datePublished">{{ .Date.Format "January 2, 2006" }}</span></div> - <div class="post-date">Last Edited: <span itemprop="dateModified">{{ .Lastmod.Format "January 2, 2006" }}</span></div> - {{ end }} - {{ end }} - {{ if .Draft }} - <div class="post-date">{{ .WordCount }} words</div> +<section id="main" class="content-container look-sheet article-pad-v {{ if (or .Params.disableMarginNotes .Site.Params.disableMarginNotes) }}no-floating-footnotes{{ end }}" itemprop="mainEntityOfPage"> + <h1 itemprop="name" id="title">{{ .Title }}</h1> + {{ if .Date }} + {{ if eq .Lastmod .Date }} + <div class="post-date"><span itemprop="datePublished">{{ .Date.Format "January 2, 2006" }}</span></div> + <meta itemprop="dateModified" content="{{ .Lastmod.Format "January 2, 2006" }}"/> + {{ else }} + <div class="post-date">Created: <span itemprop="datePublished">{{ .Date.Format "January 2, 2006" }}</span></div> + <div class="post-date">Last Edited: <span itemprop="dateModified">{{ .Lastmod.Format "January 2, 2006" }}</span></div> {{ end }} - <article itemprop="articleBody" id="content" class="article-body margin-top-2em"> - {{ .Content }} - </article> - </section> - {{ partial "footer.html" . }} - </body> -</html> + {{ end }} + {{ if .Draft }} + <div class="post-date">{{ .WordCount }} words</div> + {{ end }} + <article itemprop="articleBody" id="content" class="article-body margin-top-2em"> + {{ .Content }} + </article> +</section> +{{ end }} diff --git a/layouts/index.html b/layouts/index.html index 42ce451..46f9ba8 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,29 +1,24 @@ -{{ partial "header.html" . }} -<body lang="{{ .Site.LanguageCode }}"> - <div class="nav-bkg"> - <nav class="content-container pagewide-bar-padding"> - <span class="divider">/ </span> - <a href="{{ .Site.BaseURL }}" >{{ .Site.Title }}</a> - {{ partial "right-links" . }} - </nav> - </div> - - <section id="main" class="content-container article-pad-v"> - <div> - <h1 id="title" style="margin-bottom: 0.75em">{{.Site.Title}}</h1> - <ul id="list" class="list-unstyled list-of-titles"> - {{ range .Site.Params.Menu }} - <li> - <a href="{{ .url | relURL }}"> - <span class="post-title">{{ .name }}</span> - </a> - </li> - {{ end }} - </ul> - </div> - </section> - - {{ partial "footer.html" . }} - </body> -</html> +{{ define "content" }} +<div class="nav-bkg"> + <nav class="content-container pagewide-bar-padding"> + <span class="divider">/ </span> + <a href="{{ .Site.BaseURL }}" >{{ .Site.Title }}</a> + {{ partial "right-links" . }} + </nav> +</div> +<section id="main" class="content-container article-pad-v"> + <div> + <h1 id="title" style="margin-bottom: 0.75em">{{.Site.Title}}</h1> + <ul id="list" class="list-unstyled list-of-titles"> + {{ range .Site.Params.Menu }} + <li> + <a href="{{ .url | relURL }}"> + <span class="post-title">{{ .name }}</span> + </a> + </li> + {{ end }} + </ul> + </div> +</section> +{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html deleted file mode 100644 index e69de29..0000000 --- a/layouts/partials/head.html +++ /dev/null diff --git a/layouts/partials/header.html b/layouts/partials/header.html deleted file mode 100644 index fb3f309..0000000 --- a/layouts/partials/header.html +++ /dev/null @@ -1,27 +0,0 @@ -<!DOCTYPE html> -<html - class="" - lang="{{ .Site.LanguageCode }}" - prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#" -> - <head> - <meta charset="utf-8" /> - - {{ partial "meta.html" . }} - - <title>{{ .Title }}{{ if ne $.Site.Title .Title }} || {{ $.Site.Title }}{{ end }}</title> - <link rel="canonical" href="{{ .Permalink }}" /> - - {{ with .Site.Params.RSSCanonicalLink }} - <link rel="alternate" type="application/rss+xml" href="{{ . | absURL }}" title="{{$.Site.Title}}" /> - {{ else }} - {{- with .OutputFormats.Get "rss" -}} - {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} - {{- end -}} - {{ end }} - - {{ partial "head_includes.html" . }} - <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> - <link rel="apple-touch-icon" href="/apple-touch-icon.png" /> - </head> - diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 0dec9c5..50b74a0 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -1,70 +1,67 @@ -{{ partial "header.html" . }} -<body - class="{{ if .Draft }}draft{{ end }} look-sheet-bkg" - lang="{{ .Site.LanguageCode }}" - itemscope - itemtype="http://schema.org/Article" > - <meta itemprop="author" content="{{ .Site.Params.Author }}" /> - <meta itemprop="publisher" content="{{ .Site.Params.Author }}" /> - <meta itemprop="image" content="{{ partial "feature_image" . }}" /> +{{ define "body-classes" }} + {{ if .Draft }}draft{{ end }} look-sheet-bkg +{{ end }} - <div class="nav-bkg"> - <nav class="content-container pagewide-bar-padding"> - <span class="divider">/ </span> - <a href="{{ .Site.BaseURL }}" >{{ .Site.Title }}</a> - <span class="divider">/ </span> - <a href="{{ .Site.BaseURL }}{{ .CurrentSection.Type }}">{{.CurrentSection.Name}}</a> - {{ partial "right-links" . }} - </nav> +{{ define "content" }} +<meta itemprop="author" content="{{ .Site.Params.Author }}" /> +<meta itemprop="publisher" content="{{ .Site.Params.Author }}" /> +<meta itemprop="image" content="{{ partial "feature_image" . }}" /> + +<div class="nav-bkg"> + <nav class="content-container pagewide-bar-padding"> + <span class="divider">/ </span> + <a href="{{ .Site.BaseURL }}" >{{ .Site.Title }}</a> + <span class="divider">/ </span> + <a href="{{ .Site.BaseURL }}{{ .CurrentSection.Type }}">{{.CurrentSection.Name}}</a> + {{ partial "right-links" . }} + </nav> +</div> +<section id="main" class="content-container look-sheet article-pad-v {{ if (or .Params.disableMarginNotes .Site.Params.disableMarginNotes) }}no-floating-footnotes{{ end }}" itemprop="mainEntityOfPage"> + <h1 itemprop="name" id="title">{{ .Title }}</h1> + <meta itemprop="headline" content="{{ .Title }}" /> + {{ if .Params.tags }} + <div class="post-tags"> + {{ range .Params.tags }} + <a href="{{ (urlize (printf "tags/%s/" .)) | absLangURL }}">#{{ . }}</a> + {{ end }} </div> - <section id="main" class="content-container look-sheet article-pad-v {{ if (or .Params.disableMarginNotes .Site.Params.disableMarginNotes) }}no-floating-footnotes{{ end }}" itemprop="mainEntityOfPage"> - <h1 itemprop="name" id="title">{{ .Title }}</h1> - <meta itemprop="headline" content="{{ .Title }}" /> - {{ if .Params.tags }} - <div class="post-tags"> - {{ range .Params.tags }} - <a href="{{ (urlize (printf "tags/%s/" .)) | absLangURL }}">#{{ . }}</a> - {{ end }} - </div> - {{ end }} - {{ if eq .Lastmod .Date }} - <div class="post-date"><span itemprop="datePublished">{{ .Date.Format "January 2, 2006" }}</span></div> - <meta itemprop="dateModified" content="{{ .Lastmod.Format "January 2, 2006" }}"/> - {{ else }} - <div class="post-date">Created: <span itemprop="datePublished">{{ .Date.Format "January 2, 2006" }}</span></div> - <div class="post-date">Last Edited: <span itemprop="dateModified">{{ .Lastmod.Format "January 2, 2006" }}</span></div> - {{ end }} - {{ if .Draft }} - <div class="post-date">{{ .WordCount }} words</div> - {{ end }} - <article itemprop="articleBody" id="content" class="article-body margin-top-2em"> - {{ .Content }} - </article> - </section> - <!-- TODO: right now, this gets weird when there's a big title on the right. - There might be better info here: https://stackoverflow.com/questions/34995740/css-when-inline-block-elements-line-break-parent-wrapper-does-not-fit-new-width - and you can test on the android-development-developer-productivity article. + {{ end }} + {{ if eq .Lastmod .Date }} + <div class="post-date"><span itemprop="datePublished">{{ .Date.Format "January 2, 2006" }}</span></div> + <meta itemprop="dateModified" content="{{ .Lastmod.Format "January 2, 2006" }}"/> + {{ else }} + <div class="post-date">Created: <span itemprop="datePublished">{{ .Date.Format "January 2, 2006" }}</span></div> + <div class="post-date">Last Edited: <span itemprop="dateModified">{{ .Lastmod.Format "January 2, 2006" }}</span></div> + {{ end }} + {{ if .Draft }} + <div class="post-date">{{ .WordCount }} words</div> + {{ end }} + <article itemprop="articleBody" id="content" class="article-body margin-top-2em"> + {{ .Content }} + </article> +</section> +<!-- TODO: right now, this gets weird when there's a big title on the right. +There might be better info here: https://stackoverflow.com/questions/34995740/css-when-inline-block-elements-line-break-parent-wrapper-does-not-fit-new-width +and you can test on the android-development-developer-productivity article. - Would also be cool to make this fold on mobile so there's two links on separate lines. - --> - <div class="nav-bkg-50 content-container-narrow-pad bottom-links text-0p75"> - <nav class="flex-row"> - {{if .PrevInSection}} - <a href="{{.PrevInSection.Permalink}}" class="flex-row v-center no-underline" style="max-width:45%;"> - <span class="text-1p5">←</span> <span class="re-underline">Previous: {{ .PrevInSection.Title }}</span> +Would also be cool to make this fold on mobile so there's two links on separate lines. +--> +<div class="nav-bkg-50 content-container-narrow-pad bottom-links text-0p75"> + <nav class="flex-row"> + {{if .PrevInSection}} + <a href="{{.PrevInSection.Permalink}}" class="flex-row v-center no-underline" style="max-width:45%;"> + <span class="text-1p5">←</span> <span class="re-underline">Previous: {{ .PrevInSection.Title }}</span> + </a> + {{else}} + <span class="flex-row v-center"></span> + {{end}} + {{if .NextInSection}} + <a href="{{.NextInSection.Permalink}}" class="flex-row v-center no-underline" style="max-width: 45%;"> + <span class="re-underline">Next: {{.NextInSection.Title}}</span> <span class="text-1p5">→</span> </a> - {{else}} - <span class="flex-row v-center"></span> - {{end}} - {{if .NextInSection}} - <a href="{{.NextInSection.Permalink}}" class="flex-row v-center no-underline" style="max-width: 45%;"> - <span class="re-underline">Next: {{.NextInSection.Title}}</span> <span class="text-1p5">→</span> - </a> - {{else}} - <span class="flex-row v-center"></span> - {{end}} - </nav> - </div> - {{ partial "footer.html" . }} - </body> -</html> + {{else}} + <span class="flex-row v-center"></span> + {{end}} + </nav> +</div> +{{ end }} diff --git a/layouts/taxonomy/taxonomy.html b/layouts/taxonomy/taxonomy.html index 5958214..a3e6d06 100644 --- a/layouts/taxonomy/taxonomy.html +++ b/layouts/taxonomy/taxonomy.html @@ -1,32 +1,28 @@ -{{ partial "header.html" . }} -<body lang="{{ .Site.LanguageCode }}"> - <div class="nav-bkg"> - <nav class="content-container pagewide-bar-padding"> - <span class="divider">/ </span> - <a href="{{ .Site.BaseURL }}" >{{ .Site.Title }}</a> - <span class="divider">/ </span> - <a href="{{ .Site.BaseURL }}{{ .Data.Plural }}">{{.Data.Plural}}</a> - {{ partial "right-links" . }} - </nav> - </div> - - <section id="main" class="content-container article-pad-v"> - <div> - <h1 id="title" style="margin-bottom: 0.75em">{{.Data.Term}}</h1> - <ul id="list" class="list-unstyled list-of-titles"> - {{ range .Data.Pages.ByDate.Reverse }} - <li class="{{ if .Draft }}draft{{ end }}"> - <a href="{{ .RelPermalink}}"> - <span class="post-title">{{ .Title }}</span> - <br> - <span class="post-meta">{{ .Date.Format "January 2, 2006" }}</span> - </a> - </li> - {{ end }} - </ul> - </div> - </section> +{{ define "content" }} +<div class="nav-bkg"> + <nav class="content-container pagewide-bar-padding"> + <span class="divider">/ </span> + <a href="{{ .Site.BaseURL }}" >{{ .Site.Title }}</a> + <span class="divider">/ </span> + <a href="{{ .Site.BaseURL }}{{ .Data.Plural }}">{{.Data.Plural}}</a> + {{ partial "right-links" . }} + </nav> +</div> - {{ partial "footer.html" . }} - </body> -</html> +<section id="main" class="content-container article-pad-v"> + <div> + <h1 id="title" style="margin-bottom: 0.75em">{{.Data.Term}}</h1> + <ul id="list" class="list-unstyled list-of-titles"> + {{ range .Data.Pages.ByDate.Reverse }} + <li class="{{ if .Draft }}draft{{ end }}"> + <a href="{{ .RelPermalink}}"> + <span class="post-title">{{ .Title }}</span> + <br> + <span class="post-meta">{{ .Date.Format "January 2, 2006" }}</span> + </a> + </li> + {{ end }} + </ul> + </div> +</section> +{{ end }} diff --git a/layouts/taxonomy/terms.html b/layouts/taxonomy/terms.html index e11461a..3bbb638 100644 --- a/layouts/taxonomy/terms.html +++ b/layouts/taxonomy/terms.html @@ -1,39 +1,35 @@ -{{ partial "header.html" . }} -<body lang="{{ .Site.LanguageCode }}"> - <div class="nav-bkg"> - <nav class="content-container pagewide-bar-padding"> - <span class="divider">/ </span> - <a href="{{ .Site.BaseURL }}" >{{ .Site.Title }}</a> - {{ partial "right-links" . }} - </nav> - </div> +{{ define "content" }} +<div class="nav-bkg"> + <nav class="content-container pagewide-bar-padding"> + <span class="divider">/ </span> + <a href="{{ .Site.BaseURL }}" >{{ .Site.Title }}</a> + {{ partial "right-links" . }} + </nav> +</div> - <section id="main" class="content-container article-pad-v"> - <div> - <h1 id="title" style="margin-bottom: 0.75em">{{.Data.Plural}}</h1> - <ul id="list" class="list-unstyled list-of-titles"> - {{ range .Data.Terms.ByCount }} - {{ with .Page }} - {{ $numDrafts := len (where .Pages ".Draft" true) }} - <li class="{{ if gt $numDrafts 0 }}draft{{ end }}"> - <a href="{{ .RelPermalink}}"> - <span class="post-title">#{{ .Title }}</span> - <br> - <span class="post-meta">{{len .Pages}} {{if ne (len .Pages) 1}}entries{{else}}entry{{end}}</span> +<section id="main" class="content-container article-pad-v"> + <div> + <h1 id="title" style="margin-bottom: 0.75em">{{.Data.Plural}}</h1> + <ul id="list" class="list-unstyled list-of-titles"> + {{ range .Data.Terms.ByCount }} + {{ with .Page }} + {{ $numDrafts := len (where .Pages ".Draft" true) }} + <li class="{{ if gt $numDrafts 0 }}draft{{ end }}"> + <a href="{{ .RelPermalink}}"> + <span class="post-title">#{{ .Title }}</span> + <br> + <span class="post-meta">{{len .Pages}} {{if ne (len .Pages) 1}}entries{{else}}entry{{end}}</span> + <br> + {{ if gt $numDrafts 0 }} + <span class="post-meta draft">Including {{ $numDrafts }} {{if ne $numDrafts 1}}drafts{{else}}draft{{end}}</span> <br> - {{ if gt $numDrafts 0 }} - <span class="post-meta draft">Including {{ $numDrafts }} {{if ne $numDrafts 1}}drafts{{else}}draft{{end}}</span> - <br> - {{ end }} - <span class="post-meta">Last updated {{ .Lastmod.Format "January 2, 2006" }}</span> - </a> - </li> - {{ end }} + {{ end }} + <span class="post-meta">Last updated {{ .Lastmod.Format "January 2, 2006" }}</span> + </a> + </li> {{ end }} - </ul> - </div> - </section> - - {{ partial "footer.html" . }} - </body> -</html> + {{ end }} + </ul> + </div> +</section> +{{ end }} |