boston-library / commonwealth-vlr-engine

Commonwealth-VLR-Engine is a Rails engine for creating Blacklight apps that provide access to content from Solr/Fedora, packaging a number of feature-rich enhancements and modifications.
Apache License 2.0
8 stars 2 forks source link

DocumentPresenter#html_title should use MetadataHelperBehavior#render_title #85

Closed ebenenglish closed 3 months ago

ebenenglish commented 1 year ago

Blacklight uses the Blacklight::DocumentPresenter#html_title method to provide the page title text used in the HTML <head><title> element (app/presenters/blacklight/document_presenter.rb).

We want to incorporate the fully rendered title (MetadataHelperBehavior#render_title) so that we get this:

<title>The Evening Tribune. April 12, 1890 - Digital Commonwealth</title>

Instead of:

<title>The Evening Tribune - Digital Commonwealth</title>

The latter is bad for SEO, since there are thousands of pages with the same title. Search engine crawlers may not interpret these as unique pages.

ebenenglish commented 9 months ago

We should also use the #render_title method for the exemplary image details on collections#show.

The collection image title is set in CollectionsControllerBehavior#collection_image_info:

col_img_info[:title] = col_img_obj_doc[blacklight_config.index.title_field.to_sym]

So we will need to call the helper method from the controller, this may work:

col_img_info[:title] = helpers.render_title(col_img_file_doc)

AND

We should also use #render_title in app/views/catalog/_opengraph.html.erb.