move site suffix into title always

this tweaks the behavior of the title to always append ' - suffix' to
any title (from the meta tag, or generated via request path), unless the
page explicitly specifies an empty Title meta tag
This commit is contained in:
2021-02-20 23:18:36 -06:00
parent dd7687884a
commit f08c1117d8
4 changed files with 16 additions and 5 deletions

View File

@@ -44,8 +44,9 @@ def display_page(path):
parent_navs = generate_parent_navs(resolved_path)
page_title = (get_meta_str(md, 'title') if md.Meta.get('title') else
f'/{instance_resource_path_to_request_path(resolved_path)}')
page_name = (get_meta_str(md, 'title') if md.Meta.get('title') else
f'/{instance_resource_path_to_request_path(resolved_path)}')
page_title = f'{page_name} - {app.config["TITLE_SUFFIX"]}' if page_name else app.config['TITLE_SUFFIX']
logger.debug("title (potentially derived): %s", page_title)
return render('base.html', title=page_title, description=get_meta_str(md, 'description'),

View File

@@ -1,6 +1,6 @@
<!doctype html>
<html lang="en">
<title>{{ title }}{% if title %} - {% endif %}{{ config.TITLE_SUFFIX }}</title>
<title>{{ title }}</title>
{% if title %}<meta property="og:title" content="{{ title }}">{% endif %}
{% if description %}<meta property="og:description" content="{{ description }}">{% endif %}
{% if image %}<meta property="og:image" content="{{ image }}">{% endif %}