Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEO: improved titles for Skosmos 3 generated HTML pages #1625

Merged
merged 4 commits into from
Aug 13, 2024

Conversation

osma
Copy link
Member

@osma osma commented Apr 18, 2024

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 #1533 (comment) .

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

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

  • this PR doesn't implement long titles (skosmos:serviceNameLong setting) for the landing page, but just uses regular serviceName for the landing page title; implementing long titles is left to another PR

Checklist

  • phpUnit tests pass locally with my changes
  • 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)
  • 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)
  • The PR doesn't introduce unintended code changes (e.g. empty lines or useless reindentation)

@osma osma added this to the 3.0 milestone Apr 18, 2024
@osma osma self-assigned this Apr 18, 2024
Copy link

sonarcloud bot commented Apr 25, 2024

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarCloud

@osma osma changed the title WIP: SEO for Skosmos 3 SEO: improved titles for Skosmos 3 generated HTML pages Apr 25, 2024
@@ -1,6 +1,6 @@
{% set pageType = 'error' %}
{% extends "base-template.twig" %}
{% block title %}: "Error"{% endblock %}
{% block title %}{{ "Error"| trans }} - {{ GlobalConfig.serviceName }}{% endblock %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There does not seem to be a translation string for 'Error':

The 'error' msgid should probably be added to the translation templates.

@osma osma marked this pull request as ready for review April 25, 2024 17:21
@osma osma marked this pull request as draft August 13, 2024 08:05
@osma
Copy link
Member Author

osma commented Aug 13, 2024

Converting back to draft, because I still need to:

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

Copy link

sonarcloud bot commented Aug 13, 2024

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarCloud

@osma osma marked this pull request as ready for review August 13, 2024 08:37
@osma osma requested a review from joelit August 13, 2024 09:48
Copy link
Contributor

@joelit joelit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@osma osma merged commit 951eab3 into main Aug 13, 2024
9 of 10 checks passed
@osma osma deleted the issue1533-seo-skosmos3 branch August 13, 2024 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done (verified in test.dev.finto.fi, set Milestone 3.0 for both issue & PR)
Development

Successfully merging this pull request may close these issues.

2 participants