diff options
author | rmaguiar <rmaguiar@tuta.io> | 2020-07-07 00:29:57 +0300 |
---|---|---|
committer | rmaguiar <rmaguiar@tuta.io> | 2020-07-07 00:29:57 +0300 |
commit | c6b316091bd2cb3e6f5fd046999a54cd18f553d2 (patch) | |
tree | 6ae9c2bcbe1e619cc345720cc9553183f743c1a0 /layouts | |
parent | 013f189d1cb4aee14801280688dc3ebd8af3bf76 (diff) |
Add archetypes and minor changes
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/_markup/render-image.html | 14 | ||||
-rw-r--r-- | layouts/_default/index.xml | 22 | ||||
-rw-r--r-- | layouts/_default/sitemap.xml | 40 | ||||
-rw-r--r-- | layouts/partials/cover.html | 6 | ||||
-rw-r--r-- | layouts/partials/head.html | 12 | ||||
-rw-r--r-- | layouts/shortcodes/figure.html | 6 | ||||
-rw-r--r-- | layouts/shortcodes/img.html | 6 |
7 files changed, 55 insertions, 51 deletions
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 00940a6..11ec7ea 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -16,7 +16,7 @@ {{ $file = path.Join $imgPath $file }} {{ end }} -{{ $encodedPixel := printf "image/gif;base64,%s" ((resources.Get "pixel.gif").Content | base64Encode) }} +{{ $encodedPixel := (printf "data:image/gif;base64,%s" ((resources.Get "pixel.gif").Content | base64Encode)) | safeURL }} <!-- Assume file is local if found --> {{ with $.Page.Resources.GetMatch $file }} @@ -29,13 +29,13 @@ Reduce reflow by generating a placeholder with similar size --> - {{ $encodedPlaceholder := printf "image/png;base64,%s" (((resources.Get "pixel.gif").Resize (printf "%vx%v %s" (.Resize (index $mediumRes 0)).Width (.Resize (index $mediumRes 0)).Height "png")).Content | base64Encode) }} + {{ $encodedPlaceholder := (printf "data:image/png;base64,%s" (((resources.Get "pixel.gif").Resize (printf "%vx%v %s" (.Resize (index $mediumRes 0)).Width (.Resize (index $mediumRes 0)).Height "png")).Content | base64Encode)) | safeURL }} <img class="lazyload {{ $class }}" loading="lazy" data-srcset="{{ (.Resize (index $highRes 0)).RelPermalink }} {{ index $highRes 1 }}, {{ (.Resize (index $mediumRes 0)).RelPermalink }} {{ index $mediumRes 1 }}, {{ (.Resize (index $lowRes 0)).RelPermalink }} {{ index $lowRes 1 }}" - src="data:{{ $encodedPlaceholder }}" + src="{{ $encodedPlaceholder }}" data-src="{{ (.Resize (index $mediumRes 0)).RelPermalink }}" {{ with $altText }}alt="{{ . }}"{{ end }} /> @@ -45,7 +45,7 @@ {{ with $class }}class="{{ . }}"{{ end }} loading="lazy" srcset="{{ (.Resize (index $highRes 0)).RelPermalink }} {{ index $highRes 1 }}, {{ (.Resize (index $mediumRes 0)).RelPermalink }} {{ index $mediumRes 1 }}, {{ (.Resize (index $lowRes 0)).RelPermalink }} {{ index $lowRes 1 }}" - src="data:{{ $encodedPlaceholder }}" + src="{{ $encodedPlaceholder }}" {{ with $altText }}alt="{{ . }}"{{ end }} /> </noscript> @@ -58,12 +58,12 @@ --> {{ $placeholder := (.Resize (printf "%vx %s" .Width "png")) | images.Filter (images.Contrast -100) }} - {{ $encodedPlaceholder := printf "image/png;base64,%s" ($placeholder.Content | base64Encode) }} + {{ $encodedPlaceholder := (printf "data:image/png;base64,%s" ($placeholder.Content | base64Encode)) | safeURL }} <img class="lazyload {{ $class }}" loading="lazy" - src="data:{{ $encodedPlaceholder }}" + src="{{ $encodedPlaceholder }}" data-src="{{ .RelPermalink }}" {{ with $altText }}alt="{{ . }}"{{ end }} /> @@ -85,7 +85,7 @@ <img class="lazyload {{ $class }}" loading="lazy" - src="data:{{ $encodedPixel }}" + src="{{ $encodedPixel }}" data-src="{{ . }}" {{ with $altText }}alt="{{ . }}"{{ end }} /> diff --git a/layouts/_default/index.xml b/layouts/_default/index.xml index 2f83faf..2958297 100644 --- a/layouts/_default/index.xml +++ b/layouts/_default/index.xml @@ -30,15 +30,17 @@ {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} {{ end }} - {{ range (where .Site.RegularPages ".Params.sitemap_exclude" "!=" "true") }} - <item> - <title>{{ .Title | emojify }}</title> - <link>{{ .Permalink }}</link> - <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> - {{ with .Site.Author.email }}<author>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</author>{{ end }} - <guid>{{ .Permalink }}</guid> - <description>{{ if .Description }}{{ .Description | emojify }}{{ else }}{{ .Summary | plainify | truncate 140 }}{{ end }}</description> - </item> + {{ range .Site.RegularPages }} + {{ if not .Params.sitemapExclude }} + <item> + <title>{{ .Title | emojify }}</title> + <link>{{ .Permalink }}</link> + <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> + {{ with .Site.Author.email }}<author>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</author>{{ end }} + <guid>{{ .Permalink }}</guid> + <description>{{ if .Description }}{{ .Description | emojify }}{{ else }}{{ .Summary | plainify | truncate 140 }}{{ end }}</description> + </item> + {{ end }} {{ end }} </channel> -</rss> +</rss>
\ No newline at end of file diff --git a/layouts/_default/sitemap.xml b/layouts/_default/sitemap.xml index d3fecaa..8177b07 100644 --- a/layouts/_default/sitemap.xml +++ b/layouts/_default/sitemap.xml @@ -1,27 +1,29 @@ {{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }} <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"> - {{ range (where .Site.RegularPages ".Params.sitemap_exclude" "!=" "true") }} - <url> - <loc>{{ .Permalink }}</loc> + {{ range .Site.RegularPages }} + {{ if not .Params.sitemapExclude }} + <url> + <loc>{{ .Permalink }}</loc> - {{ if not .Lastmod.IsZero }} - <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod> - {{ end }} + {{ if not .Lastmod.IsZero }} + <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod> + {{ end }} + + {{ with .Sitemap.ChangeFreq }} + <changefreq>{{ . }}</changefreq> + {{ end }} + + {{ if ge .Sitemap.Priority 0.0 }} + <priority>{{ .Sitemap.Priority }}</priority> + {{ end }} - {{ with .Sitemap.ChangeFreq }} - <changefreq>{{ . }}</changefreq> - {{ end }} - - {{ if ge .Sitemap.Priority 0.0 }} - <priority>{{ .Sitemap.Priority }}</priority> - {{ end }} - - {{ if .IsTranslated }} - {{ range .Translations }} - <xhtml:link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}" /> + {{ if .IsTranslated }} + {{ range .Translations }} + <xhtml:link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}" /> + {{ end }} {{ end }} - {{ end }} - </url> + </url> + {{ end }} {{ end }} </urlset>
\ No newline at end of file diff --git a/layouts/partials/cover.html b/layouts/partials/cover.html index 4483960..877b321 100644 --- a/layouts/partials/cover.html +++ b/layouts/partials/cover.html @@ -20,13 +20,13 @@ Reduce reflow by generating a placeholder with similar size --> - {{ $encodedPlaceholder := printf "image/png;base64,%s" (((resources.Get "pixel.gif").Resize (printf "%vx%v %s" (.Resize (index $mediumRes 0)).Width (.Resize (index $mediumRes 0)).Height "png")).Content | base64Encode) }} + {{ $encodedPlaceholder := (printf "data:image/png;base64,%s" (((resources.Get "pixel.gif").Resize (printf "%vx%v %s" (.Resize (index $mediumRes 0)).Width (.Resize (index $mediumRes 0)).Height "png")).Content | base64Encode)) | safeURL }} <img class="lazyload cover" loading="lazy" data-srcset="{{ (.Resize (index $highRes 0)).RelPermalink }} {{ index $highRes 1 }}, {{ (.Resize (index $mediumRes 0)).RelPermalink }} {{ index $mediumRes 1 }}, {{ (.Resize (index $lowRes 0)).RelPermalink }} {{ index $lowRes 1 }}" - src="data:{{ $encodedPlaceholder }}" + src="{{ $encodedPlaceholder }}" data-src="{{ (.Resize (index $mediumRes 0)).RelPermalink }}" {{ with $altText }}alt="{{ . }}"{{ end }} /> @@ -36,7 +36,7 @@ class="cover" loading="lazy" srcset="{{ (.Resize (index $highRes 0)).RelPermalink }} {{ index $highRes 1 }}, {{ (.Resize (index $mediumRes 0)).RelPermalink }} {{ index $mediumRes 1 }}, {{ (.Resize (index $lowRes 0)).RelPermalink }} {{ index $lowRes 1 }}" - src="data:{{ $encodedPlaceholder }}" + src="{{ $encodedPlaceholder }}" {{ with $altText }}alt="{{ . }}"{{ end }} /> </noscript> diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 14f775d..610f1f6 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -98,10 +98,10 @@ <!-- Canon --> -{{ if and (.IsPage) (not .Params.sitemap_exclude) }} +{{ if and (.IsPage) (not .Params.sitemapExclude) }} {{ if .Params.canonicalURL }} <link rel="canonical" href="{{ .Params.canonicalURL }}"> - {{ else if and (ne .Kind "404") (ne .Params.sitemap_exclude true) }} + {{ else if and (ne .Kind "404") (ne .Params.sitemapExclude true) }} <link rel="canonical" href="{{ .Permalink }}"> {{ end }} {{ else if (eq .Kind "section") }} @@ -161,7 +161,7 @@ <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:image" content="{{ (.Fill "1280x640").Permalink }}"> - {{ if and (in $.Site.Params.mainSections $.Section) (not .Params.sitemap_exclude) }} + {{ if and (in $.Site.Params.mainSections $.Section) (not .Params.sitemapExclude) }} {{ $.Scratch.Set "schemaCover" (slice ((.Fill "1280x640").Permalink) ((.Fill "1200x630").Permalink) ((.Resize (index $highRes 0)).Permalink)) }} {{ end }} @@ -177,7 +177,7 @@ <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:image" content="{{ (.Fill "1280x640").Permalink }}"> - {{ if and (in $.Site.Params.mainSections $.Section) (not .Params.sitemap_exclude) }} + {{ if and (in $.Site.Params.mainSections $.Section) (not .Params.sitemapExclude) }} {{ $.Scratch.Set "schemaCover" (slice ((.Fill "1280x640").Permalink) ((.Fill "1200x630").Permalink) ((.Resize (index $highRes 0)).Permalink)) }} {{ end }} @@ -185,7 +185,7 @@ {{ end -}} <!-- More social crap --> -{{ if and (in .Site.Params.mainSections .Section) (.IsPage) (not .Params.sitemap_exclude) }} +{{ if and (in .Site.Params.mainSections .Section) (.IsPage) (not .Params.sitemapExclude) }} <meta property="og:type" content="article"> {{ if not .Date.IsZero }} @@ -266,7 +266,7 @@ Reference: https://www.drupal.org/project/schema_metatag/issues/3097526 --> -{{ if and (in .Site.Params.mainSections .Section) (.IsPage) (not .Params.sitemap_exclude) }} +{{ if and (in .Site.Params.mainSections .Section) (.IsPage) (not .Params.sitemapExclude) }} <script type="application/ld+json"> { "@context": "https://schema.org", diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index f64607e..f9d6c9a 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -35,14 +35,14 @@ Reduce reflow by generating a placeholder with similar size --> - {{ $encodedPlaceholder := printf "image/png;base64,%s" (((resources.Get "pixel.gif").Resize (printf "%vx%v %s" (.Resize (index $mediumRes 0)).Width (.Resize (index $mediumRes 0)).Height "png")).Content | base64Encode) }} + {{ $encodedPlaceholder := (printf "data:image/png;base64,%s" (((resources.Get "pixel.gif").Resize (printf "%vx%v %s" (.Resize (index $mediumRes 0)).Width (.Resize (index $mediumRes 0)).Height "png")).Content | base64Encode)) | safeURL }} <figure> <img class="lazyload {{ $class }}" loading="lazy" data-srcset="{{ (.Resize (index $highRes 0)).RelPermalink }} {{ index $highRes 1 }}, {{ (.Resize (index $mediumRes 0)).RelPermalink }} {{ index $mediumRes 1 }}, {{ (.Resize (index $lowRes 0)).RelPermalink }} {{ index $lowRes 1 }}" - src="data:{{ $encodedPlaceholder }}" + src="{{ $encodedPlaceholder }}" data-src="{{ (.Resize (index $mediumRes 0)).RelPermalink }}" {{ with $alt }}alt="{{ . }}"{{ end }} /> @@ -52,7 +52,7 @@ {{ with $class }}class="{{ . }}"{{ end }} loading="lazy" srcset="{{ (.Resize (index $highRes 0)).RelPermalink }} {{ index $highRes 1 }}, {{ (.Resize (index $mediumRes 0)).RelPermalink }} {{ index $mediumRes 1 }}, {{ (.Resize (index $lowRes 0)).RelPermalink }} {{ index $lowRes 1 }}" - src="data:{{ $encodedPlaceholder }}" + src="{{ $encodedPlaceholder }}" {{ with $alt }}alt="{{ . }}"{{ end }} /> </noscript> diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html index deffe64..c651ff6 100644 --- a/layouts/shortcodes/img.html +++ b/layouts/shortcodes/img.html @@ -33,13 +33,13 @@ Reduce reflow by generating a placeholder with similar size --> - {{ $encodedPlaceholder := printf "image/png;base64,%s" (((resources.Get "pixel.gif").Resize (printf "%vx%v %s" (.Resize (index $mediumRes 0)).Width (.Resize (index $mediumRes 0)).Height "png")).Content | base64Encode) }} + {{ $encodedPlaceholder := (printf "data:image/png;base64,%s" (((resources.Get "pixel.gif").Resize (printf "%vx%v %s" (.Resize (index $mediumRes 0)).Width (.Resize (index $mediumRes 0)).Height "png")).Content | base64Encode)) | safeURL }} <img class="lazyload {{ $class }}" loading="lazy" data-srcset="{{ (.Resize (index $highRes 0)).RelPermalink }} {{ index $highRes 1 }}, {{ (.Resize (index $mediumRes 0)).RelPermalink }} {{ index $mediumRes 1 }}, {{ (.Resize (index $lowRes 0)).RelPermalink }} {{ index $lowRes 1 }}" - src="data:{{ $encodedPlaceholder }}" + src="{{ $encodedPlaceholder }}" data-src="{{ (.Resize (index $mediumRes 0)).RelPermalink }}" {{ with $altText }}alt="{{ . }}"{{ end }} /> @@ -49,7 +49,7 @@ {{ with $class }}class="{{ . }}"{{ end }} loading="lazy" srcset="{{ (.Resize (index $highRes 0)).RelPermalink }} {{ index $highRes 1 }}, {{ (.Resize (index $mediumRes 0)).RelPermalink }} {{ index $mediumRes 1 }}, {{ (.Resize (index $lowRes 0)).RelPermalink }} {{ index $lowRes 1 }}" - src="data:{{ $encodedPlaceholder }}" + src="{{ $encodedPlaceholder }}" {{ with $altText }}alt="{{ . }}"{{ end }} /> </noscript> |