jekyll icon indicating copy to clipboard operation
jekyll copied to clipboard

Partnership banner logic

Open tiagosousagarcia opened this issue 3 years ago • 8 comments

Closes #2542

Summary

This change suggests the addition of logic that will automatically insert a banner when a published lesson is part of a special series as a result of a partnership or event (for example, the PH/JISC/TNA partnership). The logic is, essentially, akin to that of the tutorials that are part of a series: it checks the lesson for a YAML field and, if that exists, adds the banner and the text contained in snippets.yml

There are improvements to be made (some of them listed below), and the snippets need to be translated, but I would hold off requesting the translation until the technical team (and anyone else more broadly), has the opportunity to review this proposal.

Changes

Changes have been made in two files, and a new page has been created. These are:

  • snippets.yml: Two new snippets have been created, lesson-partners and partnership-url. The snippet contains the main text of the banner in the four languages (ES, FR, and PT translation needed, eventually). The second is divided into two parts: blurb contains additional text to be added to the banner if the partnership/event has a dedicated page; clickable-text is the portion of text that should be clickable in each language. The contents of lesson-partners in each lesson's metadata should be an array containing the names of the partners as they should appear to the reader (i.e., [JISC, The National Archives]; the contents of partnership-url should be the link to the partnerships dedicated page (i.e., '/jisc-tna-partnership')
  • lesson.html: The logic for the inclusion of the partnership has been added. It simply tests for the existence of lesson-partners: if it exists, it then adds the text for the respective language; and, following that, adds the contents of lesson-partners with different options depending on the number of partners (1, 2 or more partners). It then tests for the existence of a dedicated partnership page: if exists, it adds the respective snippet to the div and creates a link;
  • jisc-tna-partnership.md -- example of a dedicated partnership page. The blurb is currently a placeholder. The logic is relatively simple: an array is created with the target partnership, and each page is tested to see if it contains the same array in lesson-partnerships -- if it does, it is added to the list. Similar, in this, to the logic in lesson-retirement-policy.md

Testing locally

Simply add one or both of the YAML fields to any lesson.

Improvements

  • The search for lessons in the same partnership for the dedicate webpage could be improved by accounting for slightly different cases (Jisc vs JISC) and the inclusion of the partners in different order; I've tried to implement this by changing to lowercase and sorting before comparing, but clearly am still struggling with Liquid, so left it out of this pull request;
  • There is probably a more efficient way of building a list of pages that are part of the same partnership, than what I wrote, but someone with better knowledge of the site's structure will need to point me to it.

Build time

There was no significant change to local build on my machine

Reviewers

I've added the technical team as the main reviewer, but please let me know who else needs to see this before a decision can be made

I've commented the new code as much as I could but, if anything is not clear, let me know.

Thank you all!

Checklist

  • [x] Assign yourself in the "Assignees" menu
  • [x] Assign at least one individual or team to "Reviewers"
    • [ ] if the text needs to be translated, assign the relevant language team(s) as "Reviewers" and tag both the team as well as the managing edtor in your PR. Please follow the translation request guidelines when writing your PR description
  • [x] Add the appropriate "Label"
  • [x] Ensure the status checks pass
  • [x] Check the live preview of your PR on Netlify
  • [x] If this PR closes an open issue, add the phrase Closes #ISSUENUMBER to the description above

If you are having difficulty fixing build errors, first consult https://github.com/programminghistorian/jekyll/wiki/Making-Technical-Contributions carefully, especially "Common Build Errors". Then contact the technical team if you need further help.

tiagosousagarcia avatar Jul 05 '22 22:07 tiagosousagarcia

Just a small note to say that I'm leaving PH this week -- however, I'm still happy to answer any questions arising from this PR whenever they show up, and make any small changes that need to be made. I should still receive notifications if I'm tagged! (if not, @drjwbaker has my email)

tiagosousagarcia avatar Aug 08 '22 14:08 tiagosousagarcia

Hey @anisa-hawes. Re https://github.com/programminghistorian/ph-submissions/issues/419#issuecomment-1234451351 , summarsing threads on Slack:

  • logic isn't onerous.
  • @ZoeLeBlanc expressed a preference over this to hard coding.
  • whilst ready to merge, @tiagosousagarcia & I felt that the @programminghistorian/technical-team should confirm their support before we do so.

drjwbaker avatar Sep 06 '22 08:09 drjwbaker

@anisa-hawes Do you want to do the merging honours here?

drjwbaker avatar Sep 22 '22 07:09 drjwbaker

Thank you, @ZoeLeBlanc & @drjwbaker !

Before merging, we need to translate the following:

  • [x] _data/snippets.yml:
lesson-partners: 
  en: This tutorial is part of a special series in partnership with
  es: ES - This tutorial is part of a special series in partnership with
  fr: FR - This tutorial is part of a special series in partnership with
  pt: PT - This tutorial is part of a special series in partnership with
# Link to partnership page
# Content of 'partnership-url' for each tutorial should be the address for the partnership page (sans .md), i.e.:
# partnership-url: /jisc-tna-partnership
partnership-url:
  en:
    blurb: To see other tutorials published as part of this partnership
    clickable-text: click here
  es:
    blurb: ES - To see other tutorials published as part of this partnership
    clickable-text: ES - click here
  fr: 
    blurb: FR - To see other tutorials published as part of this partnership
    clickable-text: FR - click here
  pt:
    blurb: PT - To see other tutorials published as part of this partnership
    clickable-text: PT - click here
  • [x] en/jisc-tna-partnership.md (At the moment, the blurb is template text in Latin, so I will slot in the English but we also need to create es/, fr/ and pt/ versions of this page)
---
title: Lessons published in partnership with JISC and The National Archives
layout: blank
redirect_from: /jisc-tna-partnership
---

# Lessons in partnership with [JISC](https://www.jisc.ac.uk/) and [The National Archives](https://www.nationalarchives.gov.uk/)

<!-- Partnership blurb -->
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris bibendum quis libero ac commodo. Vivamus non mollis nisl. Nulla dolor eros, rutrum sagittis justo id, sollicitudin faucibus tortor. Praesent varius mollis ipsum. Duis bibendum efficitur nunc eu semper. Duis mattis urna nec massa ornare, sit amet congue mi blandit. Ut sollicitudin metus nec orci auctor facilisis. Suspendisse ac porttitor diam, a eleifend lorem. Quisque rutrum non nisi sed malesuada. Vestibulum iaculis tortor orci, eu consequat diam porttitor in. Aliquam porta interdum arcu, eu molestie diam accumsan a.

<!-- Defines an array to find the lessons that are part of the partnership -->
{% assign partnership = "JISC, The National Archives" | split: ", " %}

<!-- Loops through the lessons to find the ones that are part of the partnership -->
{% for lesson in site.pages %}
{% if lesson.lesson-partners == partnership %}

- [{{ lesson.title }}]({{ lesson.url }})

{% endif %}
{% endfor %}

anisa-hawes avatar Sep 22 '22 10:09 anisa-hawes

@anisa-hawes, the ES translation for _snippets.yml is ready. Once the text for jisc-tna-partnership.md is done, I can make the version for es/

rivaquiroga avatar Sep 22 '22 15:09 rivaquiroga

Thank you, @rivaquiroga!

I prepared this: Esta lección es parte de una serie especial sobre el análisis computacional de colecciones digitales a gran escala. Se publica con el generoso apoyo y colaboración de Jisc y The National Archives. Para ver otras lecciones de esta serie, haga clic (aquí)[LINK] but I will re-check it against your changes!

I will chat with James about what introductory text is needed for the .md file specifically.

Something is still wrong with our HTML proofer... 🙁

anisa-hawes avatar Sep 22 '22 15:09 anisa-hawes

I've added in some draft translations for the snippets in FR and PT. See here (and pasted below)

lesson-partners: 
  en: This lesson is part of a special series in partnership with
  es: ES - Esta lección es parte de una serie especial en colaboración con
  fr: FR - Cette leçon fait partie d'une série spéciale en partenariat avec
  pt: PT - Esta lição faz parte de uma série especial em parceria com
# Link to partnership page
# Content of 'partnership-url' for each tutorial should be the address for the partnership page (sans .md), i.e.:
# partnership-url: /jisc-tna-partnership
partnership-url:
  en:
    blurb: To browse other lessons in this series
    clickable-text: click here
  es:
    blurb: ES - Para ver otras lecciones publicados como parte de esta colaboración
    clickable-text: ES - haz clic aquí
  fr: 
    blurb: FR - Pour consulter les autres leçons de cette série
    clickable-text: FR - cliquez ici
  pt:
    blurb: PT - Para consultar outras lições desta série
    clickable-text: PT - clique aqui

Hello @ZoeLeBlanc Am I correct that FR -, ES -, PT - as written above in capital letters are not required to be repeated at each line? Should it simply be (for example, the French):

fr: 
    blurb: Pour consulter les autres leçons de cette série
    clickable-text: cliquez ici

anisa-hawes avatar Sep 22 '22 16:09 anisa-hawes

Sorry for the late reply. The Portuguese translations are good. Thanks @anisa-hawes

DanielAlvesLABDH avatar Sep 23 '22 07:09 DanielAlvesLABDH

Is this pull request almost ready to be merged? It's been holding up a couple JISC English lessons from being published. Minor edits for typos or language translation could be updated iteratively, but it would be nice to get the feature live so publishing can continue...

hawc2 avatar Sep 27 '22 13:09 hawc2

I think Anisa is waiting for clarification on https://github.com/programminghistorian/jekyll/pull/2616#issuecomment-1255287631 (@anisa-hawes: I believe you are right).

drjwbaker avatar Sep 27 '22 16:09 drjwbaker

Yup! confirming what @drjwbaker said but we don't need those written unless for some reason we want it to show up in the text (which seems unlikely)

ZoeLeBlanc avatar Sep 27 '22 16:09 ZoeLeBlanc

Okay. I've deleted the text which we don't want to display, lines 605-628.

I'm aware that I won't be able to review the banner itself on Netlify until we stage publication of a JISC lesson. So we may need to make some tweaks them.

anisa-hawes avatar Sep 30 '22 16:09 anisa-hawes

Hmm... Is this okay? After merging in, I received a notification to say that the build had failed. The error detail can be read here. Screenshot 2022-09-30 at 18 18 10

anisa-hawes avatar Sep 30 '22 17:09 anisa-hawes

The build on our repo worked but it failed to trigger the search rebuild so it should be successfully merged in. I'm in a meeting today but I'll try and fix this weekend (looks we might need to update how we are authorizing the trigger workflow action)

ZoeLeBlanc avatar Sep 30 '22 17:09 ZoeLeBlanc

Thank you @ZoeLeBlanc. Much appreciated. We can also chat about this when we connect next Thursday.

anisa-hawes avatar Sep 30 '22 17:09 anisa-hawes

Amazing. Thanks all for bringing this to completion: and especially, @anisa-hawes for coordinating and @tiagosousagarcia for developing.

drjwbaker avatar Oct 03 '22 07:10 drjwbaker