From 30437acaf53524ed97175d513b23d8042f3cf375 Mon Sep 17 00:00:00 2001 From: Jeffrey Tse Date: Mon, 21 Aug 2023 20:33:58 +0800 Subject: feat: support to pin articles (#50) This feature can allow you to top articles via post front meta property `top`, the value is a number, the smaller the number is, the higher priority the article has. Example: ``` title: My Article top: ``` --- _includes/views/segments.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to '_includes/views/segments.html') diff --git a/_includes/views/segments.html b/_includes/views/segments.html index 2c92dc1..0cf9414 100644 --- a/_includes/views/segments.html +++ b/_includes/views/segments.html @@ -13,7 +13,13 @@ {% assign items = site.posts | where: field, key %} {% for item in items %} {% if item != nil %} -
  • {% include views/post-item.html %}
  • + {%- assign post_item_class = "" -%} + {%- if item.top -%} + {%- assign post_item_class = "top-post" -%} + {%- endif -%} +
  • + {%- include views/post-item.html -%} +
  • {% endif %} {% endfor %} {% endfor %} -- cgit v1.2.3