Skosmos
Skosmos copied to clipboard
SEO: improved titles for Skosmos 3 generated HTML pages
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-onlyclass, color contrast) - [x] The PR doesn't introduce unintended code changes (e.g. empty lines or useless reindentation)
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)
