Mercurial > libervia-templates
changeset 209:d586ea13cfed
blog: fixed setting of title:
title was not show when embedded was True, but this is always the case (articles.html
template is always shown in base.html). A new "blog_page" boolean is set when
articles.html is the main page displayed (i.e. blog posts are not embedded in an other
page like events), and use to display the title, fixing the originally intented behaviour.
fix 298
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 14 Jun 2019 12:49:04 +0200 |
parents | 89f940763b02 |
children | 0bc654ab2484 |
files | sat_templates/templates/default/base/base.html sat_templates/templates/default/blog/articles.html |
diffstat | 2 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_templates/templates/default/base/base.html Fri Jun 14 12:43:47 2019 +0200 +++ b/sat_templates/templates/default/base/base.html Fri Jun 14 12:49:04 2019 +0200 @@ -1,4 +1,5 @@ -{% set embedded = True %} {# embedded is set to avoid including base.html several times if a generic page is included (e.g. blog/articles.html) #} + {# embedded is set to avoid including base.html several times if a generic page is included (e.g. blog/articles.html) #} +{% set embedded = True %} {% import 'components/common.html' as component with context %} {{ script.include('common', '') }} {# common.js is, as its name state, a common script, so it's useful to import it here #} {{ script.include('dom_update') }} {# will check page for dom element to modify when javascript is enabled #}
--- a/sat_templates/templates/default/blog/articles.html Fri Jun 14 12:43:47 2019 +0200 +++ b/sat_templates/templates/default/blog/articles.html Fri Jun 14 12:49:04 2019 +0200 @@ -1,4 +1,5 @@ -{% if not embedded %}{% extends 'base/base.html' %}{% endif %} +{# blog_page indicate if blog is included in an other page or if it is the main one #} +{% if not embedded %}{% extends 'base/base.html' %}{% set blog_page = True %}{% endif %} {% set single = items|length == 1 %} {% set dates_format='relative' if single else 'short' %} {% import 'components/avatar.html' as avatar with context %} @@ -6,7 +7,7 @@ {% import 'input/navigation.html' as navigation with context %} {%- block title scoped -%} - {%- if not embedded -%} + {%- if blog_page -%} {%- if single -%} {{- items[0].title|default(items[0].content, true)|truncate(60, True, '…') + ' - ' + C.APP_NAME -}} {%- else -%}