From 6d027091d4c3f416cae2ded972fbf0daf365faab Mon Sep 17 00:00:00 2001
From: mathew
Date: Sat, 11 Mar 2017 16:20:50 -0600
Subject: [PATCH] Add caching of last N posts in sidebar to improve performance
---
layouts/partials/recent.html | 9 +++++++++
layouts/partials/sidebar.html | 12 +-----------
2 files changed, 10 insertions(+), 11 deletions(-)
create mode 100644 layouts/partials/recent.html
diff --git a/layouts/partials/recent.html b/layouts/partials/recent.html
new file mode 100644
index 0000000..3136837
--- /dev/null
+++ b/layouts/partials/recent.html
@@ -0,0 +1,9 @@
+
diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html
index 70c19e1..f9abafa 100644
--- a/layouts/partials/sidebar.html
+++ b/layouts/partials/sidebar.html
@@ -7,17 +7,7 @@
{{ end }}
{{ if .Site.Params.sidebar }}
- {{ $num_recent_posts := (index .Site.Params.sidebar "num_recent_posts" | default 5) }}
-
-
-
+ {{ partialCached "recent.html" .}}
{{ end }}
{{ with .Site.Menus.sidebar }}