Browse Source

fix(layouts/post): add support for after-dark@7 layout refactoring

prevents error as soon as module is set-up

fix #24
master
Josh Habdas 1 year ago
parent
commit
65de9db9d6
Signed by: jhabdas GPG Key ID: B148B31154C75A74
2 changed files with 83 additions and 22 deletions
  1. +82
    -21
      layouts/post/single.html
  2. +1
    -1
      package.json

+ 82
- 21
layouts/post/single.html View File

@ -1,30 +1,95 @@
{{ define "header" }}
{{ partial "menu.html" . }}
{{ partial "masthead.html" . }}
{{ end }}
{{ define "main" }}
<article itemscope itemtype="http://schema.org/BlogPosting">
<article itemscope itemtype="https://schema.org/BlogPosting">
{{ template "_internal/schema.html" . }}
<header>
<h1 itemprop="headline">{{ .Title }}</h1>
<h1 itemprop="headline name">{{ .Title }}</h1>
<p class="muted">
{{ partial "post/meta.html" . }}
</p>
{{ if .Description }}
<blockquote itemprop="description">{{ .Description }}</blockquote>
{{ end }}
{{ if .Resources.GetMatch "header" }}
{{ $image600 := (.Resources.GetMatch "header").Fill "600x338 q60 Center" }}
{{ $image900 := (.Resources.GetMatch "header").Fill "900x506 q70 Center" }}
{{ $image1200 := (.Resources.GetMatch "header").Fill "1200x675 q80 Center" }}
{{ $image1600 := (.Resources.GetMatch "header").Fill "1600x900 q90 Center" }}
<img
alt=""
class="lazyload blur-up"
src="{{ $image600.RelPermalink }}"
data-sizes="auto"
data-src="{{ $image1200.RelPermalink }}"
data-srcset="{{ $image600.RelPermalink }} 600w, {{ $image900.RelPermalink }} 900w, {{ $image1200.RelPermalink }} 1200w, {{ $image1600.RelPermalink }} 1600w"
>
{{ with $.Resources.GetMatch "header" }}
{{ $meta_sameas := .Params.meta.sameas }}
{{ $meta_license := .Params.meta.license }}
{{ $meta_creator := .Params.meta.creator }}
{{ $meta_description := .Params.meta.description }}
{{ $meta_keywords := .Params.meta.keywords }}
{{ $meta_contentlocation := .Params.meta.contentlocation }}
{{ $image600 := .Fill "600x338 q60 Center" }}
{{ $image900 := .Fill "900x506 q70 Center" }}
{{ $image1200 := .Fill "1200x675 q80 Center" }}
{{ $image1600 := .Fill "1600x900 q90 Center" }}
<figure aria-hidden="true" itemscope itemtype="https://schema.org/ImageObject">
<link itemprop="contentUrl" href="{{ .RelPermalink }}">
<meta itemprop="encodingFormat" content="{{ .MediaType }}">
<meta itemprop="name" content="{{ .Name | plainify }}">
{{ if (urls.Parse $meta_sameas).Host }}
<link itemprop="sameAs" href="{{ $meta_sameas }}">
{{ end }}
{{ if (urls.Parse $meta_license).Host }}
<link itemprop="license" href="{{ $meta_license }}">
{{ end }}
{{ with $meta_keywords }}
<meta itemprop="keywords" content="{{ delimit . ", " }}">
{{ end }}
{{ with $meta_contentlocation }}
<meta itemprop="contentLocation" content="{{ . | plainify }}">
{{ end }}
{{ with $meta_description }}
<meta itemprop="description" content="{{ . | plainify }}">
{{ end }}
<img
itemprop="thumbnailUrl"
alt="{{ with $meta_description }}{{ . }}{{ else }}{{ .Name | plainify }}{{ end }}"
class="lazyload blur-up"
src="{{ $image600.RelPermalink }}"
data-sizes="auto"
data-src="{{ $image1200.RelPermalink }}"
data-srcset="{{ $image600.RelPermalink }} 600w, {{ $image900.RelPermalink }} 900w, {{ $image1200.RelPermalink }} 1200w, {{ $image1600.RelPermalink }} 1600w"
>
{{ if or (not (path.Ext .Title)) (or $meta_creator $meta_sameas) }}
<style>
.hack header figure[itemtype*="ImageObject"] {
position: relative;
}
.hack header figure[itemtype*="ImageObject"] figcaption {
position: absolute;
bottom: 0;
right: 0;
text-align: right;
padding: 15px;
font-style: oblique;
font-size: smaller;
mix-blend-mode: soft-light;
}
.hack header figure[itemtype*="ImageObject"] [itemprop="headline"] {
font-weight: bold;
}
</style>
<figcaption itemprop="caption">
{{ if not (path.Ext .Title) }}
<span itemprop="headline">{{ .Title | plainify }}</span>.
{{ end }}
{{ if or $meta_creator $meta_sameas }}
Photo
{{ if $meta_creator }}
by
<span itemprop="creator">
{{ $meta_creator | plainify -}}
</span>
{{- end }}
{{- with (urls.Parse $meta_sameas).Host }}
on
{{ (strings.TrimSuffix (path.Ext .) .) | title }}
{{- end }}.
{{ end }}
</figcaption>
{{ end }}
</figure>
{{ end }}
</header>
@ -43,11 +108,6 @@
<div itemprop="articleBody">
{{ .Content }}
</div>
{{ if .Site.DisqusShortname }}
<article>
{{ template "_internal/disqus.html" . }}
</article>
{{ end }}
<footer>
<hr>
{{ partial "post/byline.html" . }}
@ -57,6 +117,7 @@
{{ end }}
{{ define "footer" }}
{{ partial "powered-by.html" . }}
{{ partial "cookie-disclaimer.html" . }}
{{/* NOTE: BEGIN MODULE CUSTOM */}}

+ 1
- 1
package.json View File

@ -25,7 +25,7 @@
"standard-version": "^6.0.1"
},
"peerDependencies": {
"after-dark": ">= 6.7.8"
"after-dark": ">= 7.0.0"
},
"config": {
"commitizen": {

Loading…
Cancel
Save