Add relatedMax param

Added possibility to set the maximum number of posts that can be displayed in related block
This commit is contained in:
vimux 2019-01-13 11:31:10 -05:00
parent 4fae038bc5
commit 7f3f0ece7c
No known key found for this signature in database
GPG key ID: 5A34FDC4EE832E34
2 changed files with 4 additions and 1 deletions

View file

@ -99,6 +99,7 @@ googleAnalytics = "" # Enable Google Analytics by entering your tracking id
tocOpen = true # Open Table of Contents block. Optional tocOpen = true # Open Table of Contents block. Optional
comments = true # Enable comments for all site pages comments = true # Enable comments for all site pages
related = true # Enable Related content for single pages related = true # Enable Related content for single pages
relatedMax = 5 # Set the maximum number of posts that can be displayed in related block. Optional
mathjax = true # Enable MathJax for all site pages mathjax = true # Enable MathJax for all site pages
mathjaxPath = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" # Specify MathJax path. Optional mathjaxPath = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" # Specify MathJax path. Optional
mathjaxConfig = "TeX-AMS-MML_HTMLorMML" # Specify MathJax config. Optional mathjaxConfig = "TeX-AMS-MML_HTMLorMML" # Specify MathJax config. Optional

View file

@ -1,4 +1,6 @@
{{ $related := .Site.RegularPages.Related . | first 5 }} {{ $relatedMax := .Site.Params.relatedMax | default 5 }}
{{ $related := .Site.RegularPages.Related . | first $relatedMax }}
{{ if and ($related) (.Param "related") }} {{ if and ($related) (.Param "related") }}
<div class="related block"> <div class="related block">
<h3 class="related__title">{{ T "related_title" }}</h3> <h3 class="related__title">{{ T "related_title" }}</h3>