mirror of
https://github.com/yrzam/yrzam-hugo-theme.git
synced 2025-12-11 02:09:05 +00:00
images, deterministic caching
This commit is contained in:
7
layouts/_default/_markup/render-image.html
Normal file
7
layouts/_default/_markup/render-image.html
Normal file
@@ -0,0 +1,7 @@
|
||||
{{ $hook_ctx := . }}
|
||||
{{ with .Page.Resources.Get .Destination | resources.Copy (replaceRE "([^/]*)$" "_$1" (path.Join .Page.Path .Destination)) | fingerprint }}
|
||||
<figure>
|
||||
<a href="{{ .RelPermalink }}"><img src="{{ .RelPermalink }}"></a>
|
||||
{{- with $hook_ctx.Text }}<figcaption>{{ . }}</figcaption>{{ end -}}
|
||||
</figure>
|
||||
{{ end }}
|
||||
@@ -5,11 +5,15 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<!-- prettier-ignore -->
|
||||
<title>{{ if not .IsHome }}{{ .LinkTitle | humanize }} - {{ end }}{{ .Site.Title }}</title>
|
||||
{{ $opts := dict "transpiler" "libsass" "targetPath" "style.css" }}
|
||||
{{ $opts := dict "transpiler" "libsass" "targetPath" "_style._c.css" }}
|
||||
{{ with resources.Get "css/index.scss" | toCSS $opts | minify | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" />
|
||||
{{ end }}
|
||||
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||
{{ range resources.Match "favicon/*.png" }}
|
||||
{{ with resources.Copy (printf "_favicon%d._c.png" .Width) . }}
|
||||
<link rel="shortcut icon" type="image/png" sizes="{{ .Width }}x{{ .Height }}" href="{{ .RelPermalink }}">
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ with .OutputFormats.Get "rss" -}}
|
||||
{{ printf `<link rel=%q type=%q href=%q title=%q>` .Rel .MediaType.Type .Permalink site.Title | safeHTML }}
|
||||
{{ end }}
|
||||
|
||||
@@ -4,10 +4,12 @@
|
||||
<div class="about-container">
|
||||
<div class="about-block">
|
||||
<div class="image-container">
|
||||
<img
|
||||
src="{{ .Params.image.link }}"
|
||||
{{ print "style" "=" "\"" "aspect-ratio:" .Params.image.ratio "\"" | safeHTMLAttr }}
|
||||
{{ with resources.Get .Params.image | fingerprint }}
|
||||
<img
|
||||
src="{{ .RelPermalink }}"
|
||||
{{ print "style" "=" "\"" "aspect-ratio:" (print .Width "/" .Height) "\"" | safeHTMLAttr }}
|
||||
/>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="info-container">
|
||||
<h1>{{ .Title }}</h1>
|
||||
@@ -22,7 +24,7 @@
|
||||
</div>
|
||||
<div class="links">
|
||||
{{- range .Params.links -}}
|
||||
<a href="{{ .link | safeURL }}" class="icon-a-wrapper">{{- partial "icon.html" .icon -}}{{- print "" -}}</a>
|
||||
<a href="{{ .url | safeURL }}" class="icon-a-wrapper" target="_blank">{{- partial "icon.html" .icon -}}{{- print "" -}}</a>
|
||||
{{- end -}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user