From 4c32fd10be0303de50b4d339f809e8e3f6e6ced7 Mon Sep 17 00:00:00 2001 From: Lars Olesen Date: Sat, 4 Jun 2022 06:48:12 +0200 Subject: [PATCH] Make it possible to not show --- _config.yml | 6 ++++++ _includes/rating.html | 13 ++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/_config.yml b/_config.yml index e1a0fab9bbb5..c6b8c8dcb4fd 100644 --- a/_config.yml +++ b/_config.yml @@ -383,6 +383,8 @@ defaults: author: lsolesen sidebar: nav: blog + rating: + show: true # _exercises - scope: path: "" @@ -402,6 +404,8 @@ defaults: nav: exercises tag_archive_path: /exercises/tags/ category_archive_path: /exercises/categories/ + rating: + show: true # _methods - scope: path: "" @@ -451,6 +455,8 @@ defaults: category_archive_path: /anatomi/categories/ sidebar: nav: "muscles" + rating: + show: true # _pages - scope: path: "" diff --git a/_includes/rating.html b/_includes/rating.html index 0406e910c427..cb124b80d4bb 100644 --- a/_includes/rating.html +++ b/_includes/rating.html @@ -1,3 +1,4 @@ +{% if page.rating.show == 'true' %} {%- assign min = 9 -%} {%- assign max = 21 -%} {%- assign diff = max | minus: min -%} @@ -12,7 +13,12 @@ {% assign rating = random_rating_final | default: 4.7 %} {% assign worst_rating = 1 %} {% assign best_rating = 5 %} -{% assign rating_count = random_rating_count | default: 17 %} +{% assign rating_count = random_rating_count | page.rating.count | default: 17 %} + +{% assign rating = include.rating | default: page.rating.rating | default: rating | default: 4.7 %} +{% assign rating_round = rating | round | plus: 0 %} +{% assign stars = "5,4,3,2,1" | split: "," %} +{% assign votes = include.votes | default: page.rating.votes | default: rating_count | default: 11 %} -{% assign rating = include.rating | default: rating | default: 4.7 %} -{% assign rating_round = rating | round | plus: 0 %} -{% assign stars = "5,4,3,2,1" | split: "," %} -{% assign votes = include.votes | default: rating_count | default: 11 %} +{% endif %}