Mercurial > libervia-templates
changeset 95:e4ffb56efd4e
blog/articles: if only one item is shown, use it's title or content as page title.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 19 Jan 2018 18:17:06 +0100 |
parents | 304cbb690f15 |
children | 94b5806b9e2f |
files | default/blog/articles.html |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/default/blog/articles.html Fri Jan 19 18:15:37 2018 +0100 +++ b/default/blog/articles.html Fri Jan 19 18:17:06 2018 +0100 @@ -2,6 +2,14 @@ {% set dates_format='relative' %} {% import 'blog/macros.html' as blog with context %} +{% block title -%} + {%- if items|length == 1 -%} + {{- items[0].title|default(items[0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}} + {%- else -%} + {{- super() -}} + {%- endif -%} +{%- endblock %} + {% block body %} <div id="blog_items"> {{ blog.show_items(items) }}