Skip to content

Commit

Permalink
add organisation name on the title tag
Browse files Browse the repository at this point in the history
The name of the organization has been added in the title tag
to allow for proper indexing by search robots.

Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
  • Loading branch information
Garfield-fr committed Dec 9, 2021
1 parent f463c70 commit bdca7be
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
5 changes: 5 additions & 0 deletions rero_ils/config.py
Expand Up @@ -171,6 +171,10 @@ def _(x):
#: Admin base template
# ADMIN_BASE_TEMPLATE = BASE_TEMPLATE

# Google
# =======================
# THEME_GOOGLE_SITE_VERIFICATION = []

# Miscellaneous variable around templates
# =======================
#: Template for security pages.
Expand Down Expand Up @@ -1727,6 +1731,7 @@ def _(x):
# Default view code for all organisations view
# TODO: Should be taken into angular
RERO_ILS_SEARCH_GLOBAL_VIEW_CODE = 'global'
RERO_ILS_SEARCH_GLOBAL_NAME = _('Global catalog')

# Default number of results in facet
RERO_ILS_DEFAULT_AGGREGATION_SIZE = 30
Expand Down
3 changes: 2 additions & 1 deletion rero_ils/theme/templates/rero_ils/page.html
Expand Up @@ -48,7 +48,8 @@
{%- endblock head_meta %}
{%- block head_title %}
{%- set title = title or _(config.THEME_SITENAME) or _('Invenio') %}
<title>{{title}}</title>
{%- set org_name = _(viewcode | viewOrganisationName) -%}
<title>{{ title }}: {{ org_name }}</title>
{%- endblock head_title %}
{%- block head_links %}
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" />
Expand Down
13 changes: 11 additions & 2 deletions rero_ils/theme/views.py
Expand Up @@ -28,9 +28,8 @@
from invenio_jsonschemas import current_jsonschemas
from invenio_jsonschemas.errors import JSONSchemaNotFound

from rero_ils.modules.organisations.api import Organisation

from .menus import init_menu_lang, init_menu_profile, init_menu_tools
from ..modules.organisations.api import Organisation
from ..permissions import can_access_professional_view

blueprint = Blueprint(
Expand Down Expand Up @@ -151,6 +150,16 @@ def url_active(string, target):
return string


@blueprint.app_template_filter('viewOrganisationName')
def view_organisation_name(viewcode):
"""Get view name."""
if viewcode != current_app.config.get('RERO_ILS_SEARCH_GLOBAL_VIEW_CODE'):
org = Organisation.get_record_by_viewcode(viewcode)
if org:
return org['name']
return current_app.config.get('RERO_ILS_SEARCH_GLOBAL_NAME', '')


def prepare_jsonschema(schema):
"""Json schema prep."""
schema = copy.deepcopy(schema)
Expand Down

0 comments on commit bdca7be

Please sign in to comment.