Commit 0474ba69 authored by Kaushal Modi's avatar Kaushal Modi

Use partialCached instead of partial where possible

Run hugo --templateMetrics --templateMetricsHints and pay attention to the
partials with "cache potential" of 100. Those are the likely candidates where
partialCached can be used instead of partial.
parent ab18be79
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<a href="#top" class="back-to-top">Back to top</a> <a href="#top" class="back-to-top">Back to top</a>
</div> </div>
{{ end }} {{ end }}
{{ partial "toc_on_side.html" . }} {{ partialCached "toc_on_side.html" . }}
{{ end }} {{ end }}
<div class="content"> <div class="content">
......
<!-- https://gist.github.com/carlmjohnson/e3716a0a89fab0484d0552a750c8cfb7 --> <!-- https://gist.github.com/carlmjohnson/e3716a0a89fab0484d0552a750c8cfb7 -->
{{- $site := .Site -}} {{- $ast := .asset -}}
{{- $asset := .asset -}} {{- with $.Site.Data.assets -}}
{{- with $site.Data.assets -}} {{- if $.Site.Params.cache_busting -}}
{{- if $site.Params.cache_busting -}} {{- if in (string $.Site.BaseURL) "localhost" -}}
{{- if in (string $site.BaseURL) "localhost" -}} {{- $ast | relURL -}}
{{- $asset | relURL -}}
{{- else -}} {{- else -}}
{{- (index . $asset) | relURL -}} {{- (index . $ast) | relURL -}}
{{- end -}} {{- end -}}
{{- else if $site.Params.cache_busting_debug -}} {{- else if $.Site.Params.cache_busting_debug -}}
{{- (index . $asset) | relURL -}} {{- (index . $ast) | relURL -}}
{{- else -}} {{- else -}}
{{- $asset | relURL -}} {{- $ast | relURL -}}
{{- end -}} {{- end -}}
{{- else -}} {{- else -}}
{{- $asset | relURL -}} {{- $ast | relURL -}}
{{- end -}} {{- end -}}
<hr /> <hr />
<footer> <footer>
{{ partial "social.html" . }} {{ partialCached "social.html" . }}
{{ if .Site.Params.source.ox_hugo }} {{ if .Site.Params.source.ox_hugo }}
<p> <p>
This site is generated using This site is generated using
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
{{ end }} {{ end }}
</p> </p>
{{ partial "indieweb-badges.html" . }} {{ partialCached "indieweb-badges.html" . }}
<!-- Fragmentions - https://github.com/chapmanu/fragmentions --> <!-- Fragmentions - https://github.com/chapmanu/fragmentions -->
<!-- With this, links like this will work! <!-- With this, links like this will work!
...@@ -45,5 +45,5 @@ ...@@ -45,5 +45,5 @@
<!-- Fragmentioner - https://github.com/kartikprabhu/fragmentioner --> <!-- Fragmentioner - https://github.com/kartikprabhu/fragmentioner -->
<script defer src="{{ partial "asset.html" (dict "Site" .Site "asset" "js/fragmentioner.js") }}"></script> <script defer src="{{ partial "asset.html" (dict "Site" .Site "asset" "js/fragmentioner.js") }}"></script>
{{ partial "h-card.html" . }} {{ partialCached "h-card.html" . }}
</footer> </footer>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</title> </title>
<!-- {{ template "_internal/google_analytics_async.html" . }} --> <!-- {{ template "_internal/google_analytics_async.html" . }} -->
{{ partial "googleanalytics.html" . }} {{ partialCached "googleanalytics.html" . }}
<!-- Lazy load CSS --> <!-- Lazy load CSS -->
<!-- https://github.com/filamentgroup/loadCSS --> <!-- https://github.com/filamentgroup/loadCSS -->
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
</style> </style>
{{ if eq (getenv "HUGO_ENV") "devel" }} {{ if eq (getenv "HUGO_ENV") "devel" }}
<style>{{ partial "debugprint.css" | safeCSS }}</style> <style>{{ partialCached "debugprint.css" . | safeCSS }}</style>
{{ end }} {{ end }}
<!-- Retain the order of loading these CSS files --> <!-- Retain the order of loading these CSS files -->
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
which are the critical components in that CSS that I can inline here. --> which are the critical components in that CSS that I can inline here. -->
<link rel="stylesheet" href="{{ partial "asset.html" (dict "Site" .Site "asset" "css/refined.css") }}"> <link rel="stylesheet" href="{{ partial "asset.html" (dict "Site" .Site "asset" "css/refined.css") }}">
{{ partial "asset_custom_css.html" . }} {{ partialCached "asset_custom_css.html" . }}
<!-- Isso --> <!-- Isso -->
<!-- https://github.com/posativ/isso/issues/287 --> <!-- https://github.com/posativ/isso/issues/287 -->
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
<script defer src="{{ partial "asset.html" (dict "Site" .Site "asset" "js/fontawesome-all.js") }}"></script> <script defer src="{{ partial "asset.html" (dict "Site" .Site "asset" "js/fontawesome-all.js") }}"></script>
{{ with .Params.mathjax }} {{ with .Params.mathjax }}
{{ partial "mathjax.html" }} {{ partialCached "mathjax.html" . }}
{{ end }} {{ end }}
<!-- Icons --> <!-- Icons -->
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
<meta name="theme-color" content="#ffffff" /> <meta name="theme-color" content="#ffffff" />
<!-- Webmention, Opengraph and Twitter --> <!-- Webmention, Opengraph and Twitter -->
{{ partial "indieweb-head.html" . }} {{ partialCached "indieweb-head.html" . }}
{{ partial "opengraph.html" . }} {{ partial "opengraph.html" . }}
{{ partial "twitter_cards.html" . }} {{ partial "twitter_cards.html" . }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment