Giving views-generated pages from Drupal unique titles to improve site SEO

There is a higher priority ‘Title found on more than one page’ SEO checkpoint in Monsido that highlights webpages with duplicate titles. Many times pages generated by Drupal Views will have duplicate titles and most of the pages in the Pharmacy site failing that checkpoint are caused by Views.
There is a Metatag: Views sub-module that ships with the main Metatags module that can fix the issues be giving Views pages unquie titles. A webpage title is the text entered in the <title> tag, can be different from the main page <h1>, and isn’t always seen easily in all browsers. Internet Explorer 11 still shows the page title in the top of a window. The Metatag: Views sub-module allows you to set the page title independenly of the main <h1> heading.

In Views UI the Metatag: Views sub-module adds a new Meta tags area in you view where you can override the page title.  Then in the Page Title field you can use tokens to give the views-generated page a unquie title. For example you could use:
[view:title] [page:title]
[view:title] [site:name]
Many times views generated pages will just use the View Title casing a lot of pages with duplicate tiles. Enabling the Metatag: Views sub-module and setting an override with tokens can fix the duplicate title SEO problem.
See this Advanced Page Titles Using Drupal Views article for more information.

Adding a node ID as class to the tag in Drupal 8

One thing I discovered recently in my college’s Drupal 8 site was that the node number CSS class that used to be applied to the <body> tag was missing. In Drupal 7 there was a unique node ID class and it looked sort of like this:

<body class=”html not-front not-logged-in no-sidebars page-node page-node- page-node-8471 node-type-article news-newsreleases context-news”>

Having this unique node number CSS class was useful for cases when specific pages needed custom styles applied.

By default, Drupal 8 seems to add no such class to pages. To get them back I added a snippet of code I found on a post. I found it was easiest to use:

* Implements hook_preprocess_html().
function themename_preprocess_html(&$variables) {
if ($node = \Drupal::request()->attributes->get(‘node’)) {
$variables[‘attributes’][‘class’][] = ‘page-node-‘ . $node->id();

in my theme’s sitetheme.theme file.

There is also a Node Class module that might help accomplish the same objective, adding unique CSS classes to a page. It’s a simple module that allows users to add custom CSS classes to any node through the node/add interface.

After adding the snippet of code above to my sitetheme.theme file I was able to target a faculty profile page that needed custom styling. Previously, without a unique CSS class, there no way to target that specific page.

Ohio State Drupal Users Group Meeting – March 22, 2018

The Ohio State Drupal Users Group is having its March 2018 meeting in 141 Sullivant Hall (the Collaboratory) on Thursday, March 22, 2018, 3:00 pm to 5:00 pm. One of the topics of discussion with be Drupal site hosting, which will probably get into hosting on cloud platforms like Pantheon or Acquia. The university also runs a hosting service that’s available for Ohio State Colleges and Departments to use. The OCIO hosting service offers some Drupal-specific information about installing, backing up, and restoring Drupal 7 and Drupal 8 websites. In Drupal 8, drush commands can be used to create backups and migrate a site from a development account to a production account. Cloud hosting services, like Pantheon or Acquia, also offer DEv, Test, and Live (production) environments and methods to move (deploy) site data between them.


There is a Sullivant Hall Collaboratory and Rotunda Reservation Request form available that other groups from the university can use to reserve that space.


Content Inventories

A content inventory is a deliverable used in the planning phase of a web design process. It’s a spreadsheet listing pages in the website by section or category. Details to inform the web team regarding frequency of updates may be included. For example if a page should be updated annually it’s noted in the entry about that page. One could consider a content inventory as a sitemap in outline format with more detail about each page. The outline may be organized by the hierarchical categories used in a website. Notes and color coding may be included to indicate the status of certain pages; whether they need improvements or updating.

Ohio State Drupal training resources from the College of Arts & Sciences

New 2016-2017 ASC Drupal CMS training articles and resources:
How to Use Images on Drupal – Preparing an Image for a Drupal (or any) Web page.
Creating an ‘Accessible’ Website – Resources to making your websites accessible.
ASC Drupal training videos on YouTube – easy video training for ASC Drupal instances.