diff --git a/content/pages/homepage.html b/content/pages/homepage.html index 5739706..45c8cd5 100644 --- a/content/pages/homepage.html +++ b/content/pages/homepage.html @@ -111,12 +111,11 @@
- {% for article in categories|category_find("blog") %} + {% for article in categories|category_find("blog")|limit(4) %}

{{ article.title }}

-

{{ article.title }}

-

{{ article.summary|striptags|e|limit(30) }}

+

{{ article.summary|striptags|e }}


diff --git a/plugins/filters.py b/plugins/filters.py index 3abfac0..12292ec 100644 --- a/plugins/filters.py +++ b/plugins/filters.py @@ -13,9 +13,12 @@ def category_find(categories, name): def limit(line, length): - if len(line) <= length: - return line - return " ".join(line.split(" ")[:length]) + '...' + if isinstance(line, str): + if len(line) <= length: + return line + return " ".join(line.split(" ")[:length]) + '...' + elif isinstance(line, list): + return line[:length] def format_title(value):