jekyll
jekyll copied to clipboard
Partnership banner logic
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-partnersandpartnership-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:blurbcontains additional text to be added to the banner if the partnership/event has a dedicated page;clickable-textis the portion of text that should be clickable in each language. The contents oflesson-partnersin 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 ofpartnership-urlshould 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 oflesson-partnerswith 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 inlesson-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 #ISSUENUMBERto 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.
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)
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.
@anisa-hawes Do you want to do the merging honours here?
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, 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/
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... 🙁
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
Sorry for the late reply. The Portuguese translations are good. Thanks @anisa-hawes
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...
I think Anisa is waiting for clarification on https://github.com/programminghistorian/jekyll/pull/2616#issuecomment-1255287631 (@anisa-hawes: I believe you are right).
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)
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.
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.

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)
Thank you @ZoeLeBlanc. Much appreciated. We can also chat about this when we connect next Thursday.
Amazing. Thanks all for bringing this to completion: and especially, @anisa-hawes for coordinating and @tiagosousagarcia for developing.