diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 9ea1861..2ba6945 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -23,14 +23,19 @@
{{ end }}
{{ if .Site.Params.showRelatedPosts }}
- {{ $related := .Site.RegularPages.Related . | first 3 }}
- {{ with $related }}
-
{{ i18n "seeAlso" }}
-
- {{ range . }}
- - {{ .Title }}
+ {{ range first 1 (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
+ {{ $.Scratch.Set "has_related" true }}
{{ end }}
-
+
+ {{ if $.Scratch.Get "has_related" }}
+ {{ i18n "seeAlso" }}
+
+ {{ $num_to_show := .Site.Params.related_content_limit | default 5 }}
+ {{ range first $num_to_show (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
+ - {{ .Title }}
+ {{ end }}
+
+
{{ end }}
{{ end }}
@@ -50,6 +55,7 @@
{{ end }}
+
{{ if (.Params.comments) | or (and (or (not (isset .Params "comments")) (eq .Params.comments nil)) (and .Site.Params.comments (ne .Type "page"))) }}
{{ partial "remark42.html" . }}
{{ if .Site.DisqusShortname }}
diff --git a/themes/beautifulhugo b/themes/beautifulhugo
index b71c275..1ff3894 160000
--- a/themes/beautifulhugo
+++ b/themes/beautifulhugo
@@ -1 +1 @@
-Subproject commit b71c2754dc32bb8690fabe795c300a7432243191
+Subproject commit 1ff3894b84b1802433b58e22dd22f4eb46a49fa9