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: long title on landing page (skosmos:serviceNameLong configuration setting) #1644

Merged
merged 4 commits into from
Aug 14, 2024

Conversation

osma
Copy link
Member

@osma osma commented Aug 14, 2024

Reasons for creating this PR

This PR makes it possible to set a long name for the service using a new setting skosmos:serviceNameLong. This name will be used as the <title> (and related metadata elements important for SEO) on the landing page. The setting is multilingual, so it is possible to set different names for different UI languages. If not set, the value of the skosmos:serviceName setting is used as a fallback.

I also adjusted the BaseConfig.getLiteral() fallback mechanism in case there is no configuration value in the requested language. In that case it picked an arbitrary value that could be in any other language. I adjusted the mechanism so it only falls back to a value without a language tag, but not to another language which could be surprising.

There's also a small change to drop twitter:title metadata because it turns out it's completely redundant according to Twitter/X developer docs when we already have og:title.

Link to relevant issue(s), if any

Description of the changes in this PR

  • add support for skosmos:serviceNameSetting in GlobalConfig
  • adjust BaseConfig.getLiteral so it uses a better fallback mechanism for multilingual values
  • PhpUnit tests for the above
  • use the serviceNameLong value in the Twig template of the landing page
  • drop use of twitter:title because it's redundant
  • Cypress test for the above

Known problems or uncertainties in this 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 self-assigned this Aug 14, 2024
@osma osma added this to the 3.0 milestone Aug 14, 2024
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.62%. Comparing base (27ce825) to head (f2cc004).
Report is 37 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1644      +/-   ##
============================================
+ Coverage     70.59%   70.62%   +0.02%     
- Complexity     1643     1645       +2     
============================================
  Files            32       32              
  Lines          4316     4320       +4     
============================================
+ Hits           3047     3051       +4     
  Misses         1269     1269              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@osma osma changed the title WIP: SEO: long title on landing page (skosmos:serviceNameLong configuration setting) SEO: long title on landing page (skosmos:serviceNameLong configuration setting) Aug 14, 2024
@osma osma marked this pull request as ready for review August 14, 2024 07:28
@osma osma marked this pull request as draft August 14, 2024 07:51
@osma osma marked this pull request as ready for review August 14, 2024 08:07
@osma osma requested a review from joelit August 14, 2024 09:59
Copy link

sonarcloud bot commented Aug 14, 2024

@@ -11,7 +11,6 @@
<meta name="generator" content="Skosmos {{ request.version }}">
<meta name="title" content="{{ block('title') }}">
<meta property="og:title" content="{{ block('title') }}">
<meta name="twitter:title" content="{{ block('title') }}">
<meta name="twitter:card" content="summary">
Copy link
Contributor

Choose a reason for hiding this comment

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

https://developer.x.com/en/docs/twitter-for-websites/cards/overview/markup#overview-of-all-twitter-card-tags

Now that we're getting rid of twitter:title in favour of og:title, we could also change twitter:card to og:type. I reckon the domain of og:type fits skosmos pages better than the domain of twitter:card.

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.

Looks good to me!

I would use this PR (or make a new one) to also change twitter:card to og:type to make sure the SE crawler can parse the metadata in the future.

@osma
Copy link
Member Author

osma commented Aug 14, 2024

I would use this PR (or make a new one) to also change twitter:card to og:type to make sure the SE crawler can parse the metadata in the future.

I think it's out of scope for this PR, which is about titles/names. But I added this to the checklist in the main issue: #1533 (comment)

Merging this as-is.

@osma osma merged commit e7e3cd2 into main Aug 14, 2024
10 checks passed
@osma osma deleted the issue1533-seo-skosmos3-longtitle branch August 14, 2024 14:42
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