1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 19:06:40 -04:00

cache some partials

This commit is contained in:
2019-12-26 22:06:04 -05:00
parent e10e0e718a
commit ef32f73372
12 changed files with 52 additions and 43 deletions

View File

@ -27,16 +27,18 @@ main#single {
display: block; display: block;
} }
// reduce margin between image and caption figure {
figure img { // reduce margin between image and caption
margin-bottom: 0.4em; img {
} margin-bottom: 0.4em;
}
// image captions // image captions
figure figcaption { figcaption {
font-size: 0.9em; font-size: 0.9em;
color: $color-medium; color: $color-medium;
text-align: center; text-align: center;
}
} }
blockquote { blockquote {
@ -96,7 +98,9 @@ main#single {
} }
} }
iframe.twitter-tweet, twitter-widget { /* stylelint-disable-next-line selector-type-no-unknown */
twitter-widget,
iframe.twitter-tweet {
margin: 0 auto; margin: 0 auto;
display: block; display: block;
} }
@ -106,7 +110,8 @@ main#single {
} }
// all code // all code
div.highlight, code { code,
div.highlight {
font-family: $system-fonts-monospace; font-family: $system-fonts-monospace;
background: $color-super-light; background: $color-super-light;
font-size: 0.9em; font-size: 0.9em;
@ -129,15 +134,17 @@ main#single {
object-fit: scale-down; object-fit: scale-down;
font-size: 1em; font-size: 1em;
margin: 1em 0; margin: 1em 0;
}
div.highlight pre { pre {
display: block; display: block;
margin-left: 1.5em; margin-left: 1.5em;
} }
// overrides inline code styles
div.highlight code { // overrides inline code styles
border: 0; code {
padding: 0; border: 0;
padding: 0;
}
} }
} }

View File

@ -5,11 +5,11 @@
{{ partial "head" . }} {{ partial "head" . }}
</head> </head>
<body> <body>
{{ partial "header" . }} {{ partialCached "header" . }}
<div id="wrap"> <div id="wrap">
{{ block "main" . }}{{ end }} {{ block "main" . }}{{ end }}
</div> </div>
{{ partial "footer" . }} {{ partialCached "footer" . }}
{{ partial "scripts" . }} {{ partial "scripts" . }}
</body> </body>
</html> </html>

View File

@ -12,7 +12,7 @@
<title>{{ .Title }} &ndash; {{ .Site.Title }}</title> <title>{{ .Title }} &ndash; {{ .Site.Title }}</title>
{{ with .OutputFormats.Get "html" }}<link rel="canonical" href="{{ .Permalink }}">{{ end }} {{ with .OutputFormats.Get "html" }}<link rel="canonical" href="{{ .Permalink }}">{{ end }}
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<meta name="description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Site.Params.description }}{{ end }}"> <meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}">
<meta name="author" content="{{ .Site.Author.name }}"> <meta name="author" content="{{ .Site.Author.name }}">
{{ partial "open-graph" . }} {{ partial "open-graph" . }}
@ -177,7 +177,7 @@
<header> <header>
<nav> <nav>
<a id="logo" href="{{ .Site.BaseURL }}" title="{{ .Site.Title }}"> <a id="logo" href="{{ .Site.BaseURL }}" title="{{ .Site.Title }}">
{{ partial "logo" . }} {{ partialCached "logo" . }}
<span id="name">{{ .Site.Title }}</span> <span id="name">{{ .Site.Title }}</span>
</a> </a>
@ -196,7 +196,7 @@
on <a class="date" href="{{ (.OutputFormats.Get "html").Permalink }}">{{ .Date.Format "January 2, 2006" }}</a> on <a class="date" href="{{ (.OutputFormats.Get "html").Permalink }}">{{ .Date.Format "January 2, 2006" }}</a>
</p> </p>
{{ .Page.RenderString .Content }} {{ .Content | .Page.RenderString }}
</article> </article>
<footer> <footer>

View File

@ -15,7 +15,7 @@
</div> </div>
</div> </div>
<div id="content"> <div id="content">
{{ .Page.RenderString .Content }} {{ .Content | .Page.RenderString }}
</div> </div>
</article> </article>
</main> </main>

View File

@ -1,7 +1,7 @@
<header> <header>
<nav> <nav>
<a class="no-underline" href="{{ .Site.BaseURL }}" id="logo" rel="me author" title="{{ .Site.Title }}" aria-label="{{ .Site.Title }}"> <a class="no-underline" href="{{ .Site.BaseURL }}" id="logo" rel="me author" title="{{ .Site.Title }}" aria-label="{{ .Site.Title }}">
{{ partial "logo" . }} {{ partialCached "logo" . }}
<h1 id="name">{{ .Site.Title }}</h1> <h1 id="name">{{ .Site.Title }}</h1>
</a> </a>
<ul> <ul>

View File

@ -3,7 +3,7 @@
<meta property="og:type" content="{{ if and .IsPage (eq .Type "notes") }}article{{ else }}website{{ end }}"> <meta property="og:type" content="{{ if and .IsPage (eq .Type "notes") }}article{{ else }}website{{ end }}">
<meta property="og:locale" content="en_US"> <meta property="og:locale" content="en_US">
<meta property="og:url" content="{{ .Permalink }}"> <meta property="og:url" content="{{ .Permalink }}">
<meta property="og:description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Site.Params.description }}{{ end }}"> <meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{ .Site.Params.description }}{{ end }}">
<meta property="og:image" content="{{ .Scratch.Get "socialImage_url" }}"> <meta property="og:image" content="{{ .Scratch.Get "socialImage_url" }}">
<meta property="og:image:width" content="{{ .Scratch.Get "socialImage_width" }}"> <meta property="og:image:width" content="{{ .Scratch.Get "socialImage_width" }}">

View File

@ -2,17 +2,21 @@
<channel> <channel>
<title>{{ .Site.Title }}</title> <title>{{ .Site.Title }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
<description>{{ .Title }}</description> <description>{{ with .Site.Params.description }}{{ . }}{{ else }}{{ .Title }}{{ end }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{ . }}</language>{{ end }}{{ with .Site.Author.email }} <language>{{ . }}</language>{{ end }}{{ with .Site.Author.email }}
<managingEditor>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with .Site.Author.email }} <managingEditor>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with .Site.Author.email }}
<webMaster>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }} <webMaster>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
<copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }} <copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}{{ with .Site.Params.defaultimage }}
{{ with .OutputFormats.Get "RSS" }} <image>
{{- printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML -}} <url>{{ . | absURL }}</url>
<title>{{ $.Site.Title }}</title>
<link>{{ $.Permalink }}</link>
</image>{{ end }}{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML -}}
{{ end }} {{ end }}
{{ range (where .Site.RegularPages "Section" "notes") }} {{- range (where .Site.RegularPages "Section" "notes") }}
<item> <item>
<title>{{ .Title }}</title> <title>{{ .Title }}</title>
<link>{{ .Permalink }}</link> <link>{{ .Permalink }}</link>
@ -20,9 +24,9 @@
{{ with .Site.Author.email }}<author>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</author>{{ end }} {{ with .Site.Author.email }}<author>{{ . }}{{ with $.Site.Author.name }} ({{ . }}){{ end }}</author>{{ end }}
<guid>{{ .Permalink }}</guid> <guid>{{ .Permalink }}</guid>
<description> <description>
{{ .Page.RenderString .Content | html }} {{ .Content | .Page.RenderString | html }}
</description> </description>
</item> </item>
{{ end }} {{- end }}
</channel> </channel>
</rss> </rss>

View File

@ -3,5 +3,5 @@
width="1200" width="1200"
height="{{ with .Get "height" }}{{ . }}{{ else }}500{{ end }}" height="{{ with .Get "height" }}{{ . }}{{ else }}500{{ end }}"
scrolling="no" scrolling="no"
src="https://codepen.io/{{ .Get "username" }}/embed/{{ .Get "id" }}/?height={{ if .Get "height" }}{{ .Get "height" }}{{ else }}500{{ end }}&amp;theme-id=light&amp;default-tab={{ .Get "left-tab" }}{{ with .Get "right-tab" }},{{ . }}{{ end }}"> src="https://codepen.io/{{ .Get "username" }}/embed/{{ .Get "id" }}/?height={{ with .Get "height" }}{{ . }}{{ else }}500{{ end }}&amp;theme-id=light&amp;default-tab={{ .Get "left-tab" }}{{ with .Get "right-tab" }},{{ . }}{{ end }}">
</amp-iframe> </amp-iframe>

View File

@ -11,4 +11,4 @@
</amp-img> </amp-img>
</p> </p>
{{- with .Inner }}<p class="caption">{{ $.Page.RenderString . | safeHTML }}</p>{{ end -}} {{- with .Inner }}<p class="caption">{{ . | $.Page.RenderString | safeHTML }}</p>{{ end -}}

View File

@ -6,7 +6,7 @@
<img src="{{ $optimized.Permalink }}" width="{{ $.Scratch.Get "displayWidth" }}" height="{{ $.Scratch.Get "displayHeight" }}" <img src="{{ $optimized.Permalink }}" width="{{ $.Scratch.Get "displayWidth" }}" height="{{ $.Scratch.Get "displayHeight" }}"
alt="{{ . | markdownify | plainify | safeHTMLAttr }}" title="{{ . | markdownify | plainify | safeHTMLAttr }}"> alt="{{ . | markdownify | plainify | safeHTMLAttr }}" title="{{ . | markdownify | plainify | safeHTMLAttr }}">
</picture> </picture>
<figcaption>{{ $.Page.RenderString . | safeHTML }}</figcaption> <figcaption>{{ . | $.Page.RenderString | safeHTML }}</figcaption>
</figure> </figure>
{{- else -}} {{- else -}}
<p><img src="{{ $optimized.Permalink }}" width="{{ $.Scratch.Get "displayWidth" }}" height="{{ $.Scratch.Get "displayHeight" }}" <p><img src="{{ $optimized.Permalink }}" width="{{ $.Scratch.Get "displayWidth" }}" height="{{ $.Scratch.Get "displayHeight" }}"

View File

@ -1,8 +1,8 @@
{{- $optimized := partial "optimize-image" . -}} {{- $optimized := partialCached "optimize-image" . (.Get "src") -}}
<p style="text-align: center;"> <p style="text-align: center;">
<img src="{{ $optimized.Permalink }}" width="{{ .Scratch.Get "displayWidth" }}" height="{{ .Scratch.Get "displayHeight" }}" <img src="{{ $optimized.Permalink }}" width="{{ .Scratch.Get "displayWidth" }}" height="{{ .Scratch.Get "displayHeight" }}"
{{- with .Get "alt" }} alt="{{ . | safeHTMLAttr }}" title="{{ . | safeHTMLAttr }}"{{ end }} {{- with .Get "alt" }} alt="{{ . | safeHTMLAttr }}" title="{{ . | safeHTMLAttr }}"{{ end }}
{{- with .Inner }} alt="{{ . | markdownify | plainify | safeHTMLAttr }}" title="{{ . | markdownify | plainify | safeHTMLAttr }}"{{ end }}> {{- with .Inner }} alt="{{ . | markdownify | plainify | safeHTMLAttr }}" title="{{ . | markdownify | plainify | safeHTMLAttr }}"{{ end }}>
{{ with .Inner }}<br>{{ $.Page.RenderString . | safeHTML }}{{ end -}} {{ with .Inner }}<br>{{ . | $.Page.RenderString | safeHTML }}{{ end -}}
</p> </p>

View File

@ -60,8 +60,6 @@
}, },
"stylelint": { "stylelint": {
"extends": "stylelint-config-recommended-scss", "extends": "stylelint-config-recommended-scss",
"rules": { "rules": {}
"selector-type-no-unknown": null
}
} }
} }