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,17 +27,19 @@ main#single {
display: block;
}
figure {
// reduce margin between image and caption
figure img {
img {
margin-bottom: 0.4em;
}
// image captions
figure figcaption {
figcaption {
font-size: 0.9em;
color: $color-medium;
text-align: center;
}
}
blockquote {
border-left: 5px solid $color-links;
@ -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;
display: block;
}
@ -106,7 +110,8 @@ main#single {
}
// all code
div.highlight, code {
code,
div.highlight {
font-family: $system-fonts-monospace;
background: $color-super-light;
font-size: 0.9em;
@ -129,17 +134,19 @@ main#single {
object-fit: scale-down;
font-size: 1em;
margin: 1em 0;
}
div.highlight pre {
pre {
display: block;
margin-left: 1.5em;
}
// overrides inline code styles
div.highlight code {
code {
border: 0;
padding: 0;
}
}
}
&#meta {
text-align: center;

View File

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

View File

@ -12,7 +12,7 @@
<title>{{ .Title }} &ndash; {{ .Site.Title }}</title>
{{ 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="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 }}">
{{ partial "open-graph" . }}
@ -177,7 +177,7 @@
<header>
<nav>
<a id="logo" href="{{ .Site.BaseURL }}" title="{{ .Site.Title }}">
{{ partial "logo" . }}
{{ partialCached "logo" . }}
<span id="name">{{ .Site.Title }}</span>
</a>
@ -196,7 +196,7 @@
on <a class="date" href="{{ (.OutputFormats.Get "html").Permalink }}">{{ .Date.Format "January 2, 2006" }}</a>
</p>
{{ .Page.RenderString .Content }}
{{ .Content | .Page.RenderString }}
</article>
<footer>

View File

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

View File

@ -1,7 +1,7 @@
<header>
<nav>
<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>
</a>
<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:locale" content="en_US">
<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:width" content="{{ .Scratch.Get "socialImage_width" }}">

View File

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

View File

@ -3,5 +3,5 @@
width="1200"
height="{{ with .Get "height" }}{{ . }}{{ else }}500{{ end }}"
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>

View File

@ -11,4 +11,4 @@
</amp-img>
</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" }}"
alt="{{ . | markdownify | plainify | safeHTMLAttr }}" title="{{ . | markdownify | plainify | safeHTMLAttr }}">
</picture>
<figcaption>{{ $.Page.RenderString . | safeHTML }}</figcaption>
<figcaption>{{ . | $.Page.RenderString | safeHTML }}</figcaption>
</figure>
{{- else -}}
<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;">
<img src="{{ $optimized.Permalink }}" width="{{ .Scratch.Get "displayWidth" }}" height="{{ .Scratch.Get "displayHeight" }}"
{{- with .Get "alt" }} alt="{{ . | safeHTMLAttr }}" title="{{ . | 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>

View File

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