Skosmos icon indicating copy to clipboard operation
Skosmos copied to clipboard

SEO: improved titles for Skosmos 3 generated HTML pages

Open osma opened this issue 1 year ago • 1 comments

Reasons for creating this PR

Improve search engine optimization in Skosmos 3 by making the <title> values and related metadata (title, twitter:title, og:title) conform to the specification in https://github.com/NatLibFi/Skosmos/issues/1533#issuecomment-2063290242 .

This PR only handles the titles, not descriptions. The descriptions will have to be implemented in a subsequent PR.

Link to relevant issue(s), if any

  • Part of #1533

Description of the changes in this PR

  • refactor: pass the GlobalConfig instance to the Twig templates, instead of individual configuration settings in separate variables
  • adapt the Twig templates to use the GlobalConfig instance, and set their title metadata to match the specification
  • add Cypress tests to verify the title values

Known problems or uncertainties in this PR

Checklist

  • [x] phpUnit tests pass locally with my changes
  • [x] I have added tests that show that the new code works, or tests are not relevant for this PR (e.g. only HTML/CSS changes)
  • [x] The PR doesn't reduce accessibility of the front-end code (e.g. tab focus, scaling to different resolutions, use of .sr-only class, color contrast)
  • [x] The PR doesn't introduce unintended code changes (e.g. empty lines or useless reindentation)

osma avatar Apr 18 '24 11:04 osma

Quality Gate Failed Quality Gate failed

Failed conditions
54.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Apr 25 '24 06:04 sonarqubecloud[bot]

Converting back to draft, because I still need to:

  • [x] add the missing "Error" msgid pointed out by @joelit
  • [x] ~implement long title (skosmos:serviceNameLong setting) for the landing page~ (decided that this is out of scope for this PR)

osma avatar Aug 13 '24 08:08 osma

Quality Gate Failed Quality Gate failed

Failed conditions
54.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Aug 13 '24 08:08 sonarqubecloud[bot]