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 functionality backport for skosmos 2 #1666

Merged
merged 14 commits into from
Aug 23, 2024

Conversation

osma
Copy link
Member

@osma osma commented Aug 22, 2024

Reasons for creating this PR

Some new SEO / social media sharing features were implemented for Skosmos 3 in several PRs related to issue #1533. This PR is a backport of these features to Skosmos 2.

Link to relevant issue(s), if any

Description of the changes in this PR

Contains commits cherry-picked and/or adapted from the following PRs that were made for Skosmos 3:

The Twig template code changes had to be rewritten because Skosmos 2 has a very different template structure than Skosmos 3. While doing this, I decided to merge meta.twig into light.twig. I also created a separate landing.twig template; previously light.twig was used both as a base template and as the template for the landing page, but this wasn't flexible enough for implementing the meta descriptions.

Known problems or uncertainties in this PR

None so far 🤞

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 enhancement Skosmos 2.X Relevant for Skosmos 2 labels Aug 22, 2024
@osma osma added this to the 2.x milestone Aug 22, 2024
@osma osma self-assigned this Aug 22, 2024
@osma osma changed the title WIP: SEO functionality backport for skosmos 2 SEO functionality backport for skosmos 2 Aug 22, 2024
Copy link

sonarcloud bot commented Aug 22, 2024

@osma osma requested a review from joelit August 22, 2024 13:32
@osma osma marked this pull request as ready for review August 22, 2024 13:43
Copy link

codecov bot commented Aug 23, 2024

Codecov Report

Attention: Patch coverage is 94.44444% with 1 line in your changes missing coverage. Please review.

Project coverage is 70.39%. Comparing base (7a53972) to head (e3c6de4).
Report is 23 commits behind head on skosmos-2.

Files Patch % Lines
controller/WebController.php 50.00% 1 Missing ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##             skosmos-2    #1666      +/-   ##
===============================================
+ Coverage        70.33%   70.39%   +0.06%     
- Complexity        1669     1674       +5     
===============================================
  Files               32       32              
  Lines             4305     4314       +9     
===============================================
+ Hits              3028     3037       +9     
  Misses            1277     1277              

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

{% block title %}: {{ vocab.shortName }}{% if search_results|length == 1 %}: {{ concept_label }}{% endif %}
{% endblock %}
{% block title %}{{ concept_label }} - {{ vocab.shortName }} - {{ GlobalConfig.serviceName }}{% endblock %}
{% block description %}{% set term = concept_label %}{% set vocabObj = vocab %}{% set vocab = vocab.title(request.contentLang) %}{% trans %}Concept {{ term }} in vocabulary {{ vocab }}{% endtrans %}{% set vocab = vocabObj %}{% endblock %}
Copy link
Contributor

Choose a reason for hiding this comment

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

The minor quip is that we have only the translation strings for "Concept X" in different languages, whereas it look a bit weird in cases where the data is instances or classification:

  • Skosmos2/ykl/en/page/2
    • "Concept RELIGION in vocabulary PLC - Finnish Public Libraries Classification System"
    • Could be currently generated as "YKL Class RELIGION ..."
  • Skosmos2/finaf/en/page/000179638
    • "Concept A. Aallon Rytmiorkesteri in vocabulary KANTO - Kansalliset toimijatiedot"
    • Could be currently merely generated as "Yhteisö A. Aallon Rytmiorkesteri ..." as there's no translation for the concept type in english in the data

One way would be to omit the word "Concept" but it's a minor thing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point! This was part of the speccing done earlier. I guess we didn't consider classifications back then.

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.

Works as expected. I encountered some minor awkwardness in the wordings of the descriptions in concept page that I hadn't spotted before. Could be a subject for further improvement.

@osma osma merged commit 090203a into skosmos-2 Aug 23, 2024
12 of 14 checks passed
@osma osma deleted the issue1533-seo-backport-for-skosmos-2 branch August 23, 2024 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Skosmos 2.X Relevant for Skosmos 2
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