Browse Source

reusable meta partial

master
Alexander Avery 9 months ago
parent
commit
4121a39b57
  1. 2
      layouts/_default/meta-extra.html
  2. 7
      layouts/games/meta-extra.html
  3. 21
      layouts/partials/article-meta.html
  4. 10
      layouts/partials/header-image.html
  5. 13
      layouts/partials/responsive-image.html

2
layouts/_default/meta-extra.html

@ -0,0 +1,2 @@
<h2 class="small-text">{{ .Date.Format "Mon | Jan 2, 2006" }}</h2>

7
layouts/games/meta-extra.html

@ -0,0 +1,7 @@
{{ if .Params.releaseDate }}
<h2 class="small-text">Released {{ dateFormat "Mon | Jan 2, 2006" .Params.releaseDate }}</h2>
<div class="break"/>
{{ end }}
<h2 class="small-text">Platforms:</h2>
<span class="margin small-text">{{ delimit .Params.platforms " · " }}</span>

21
layouts/partials/article-meta.html

@ -0,0 +1,21 @@
<div class="article-meta">
<h1 class="center-text">{{ .Title | markdownify }}</h1>
{{ $authors := .Params.authors | default (slice .Site.Params.defaultAuthor) }}
{{ $primaryAuthor := index $authors 0 }}
{{ with $primaryAuthor }}
<a class="center-text" href={{ printf "/%s/%s" "authors" (urlize .) }}>
<h2 class="center-text">{{ . }}</h2>
</a>
{{ end }}
{{ .Render "meta-extra" }}
{{ range (.GetTerms "tags") }}
<a class="small-text" href="{{ .Permalink }}">{{ .LinkTitle }}</a>
{{ end }}
{{ partial "header-image.html" (dict "image" (.Resources.GetMatch .Params.featured.url) "alt" .Params.featured.alt) }}
</div>

10
layouts/partials/header-image.html

@ -0,0 +1,10 @@
<img class="shadow large-image"
{{ with .image }}
srcset="
{{ (.Resize "320x q30").RelPermalink }} 500w,
{{ (.Resize "600x q40").RelPermalink }} 800w,
{{ (.Resize "1200x q65").RelPermalink }} 2x"
src="{{ (.Resize "320x q30").RelPermalink }}"
{{ end }}
alt="{{ .alt }}"
/>

13
layouts/partials/responsive-image.html

@ -1,15 +1,3 @@
{{ if resources.Get .context.Params.featured.url }}
<img class="{{ .class | default "fill-wh"}}"
{{ with resources.Get .context.Params.featured.url }}
srcset="
{{ (.Resize "320x q30").RelPermalink }} 500w,
{{ (.Resize "600x q40").RelPermalink }} 800w,
{{ (.Resize "1200x q65").RelPermalink }} 2x"
src="{{ (.Resize "320x q30").RelPermalink }}"
{{ end }}
alt="{{ .context.Params.featured.alt }}"
/>
{{ else }}
<img class="{{ .class | default "fill-wh"}}" <img class="{{ .class | default "fill-wh"}}"
{{ with .context.Resources.GetMatch .context.Params.featured.url }} {{ with .context.Resources.GetMatch .context.Params.featured.url }}
srcset=" srcset="
@ -20,4 +8,3 @@
alt="{{ .Params.alt }}" alt="{{ .Params.alt }}"
{{ end }} {{ end }}
/> />
{{ end }}

Loading…
Cancel
Save