diff --git a/scripts/rebrand/allowed_changes.txt b/scripts/rebrand/allowed_changes.txt
index 43093dd888f..ddb771e918c 100644
--- a/scripts/rebrand/allowed_changes.txt
+++ b/scripts/rebrand/allowed_changes.txt
@@ -52,6 +52,10 @@ glossary/arabic/مقياس_المساهمة_البحثي_ة_نشر/index.html #
glossary/arabic/p_مقياس_المساهمة_البحثي_ة_نشر/index.html # #1085: the same Arabic page under the older slug that the content committed on this branch still uses
glossary/chinese/研究贡献指标_p_/index.html # #1085: glossary titles render their Markdown, so the
, og:title and JSON-LD name read "(p)" instead of "(*p*)"
glossary/turkish/bilimsel_katkı_olcutu_p_/index.html # #1085: glossary titles render their Markdown, so the , og:title and JSON-LD name read "(p)" instead of "(*p*)"
+glossary/arabic/مقياس_المساهمة_البحثي_ة/index.html # #1085: the same title change, under the slug the data artifact now uses
+glossary/chinese/研究贡献指标_p/index.html # #1085: the same title change, under the slug the data artifact now uses
+glossary/english/research_contribution_metric__p/index.html # #1085: the same title change, under the slug the data artifact now uses
+glossary/turkish/bilimsel_katkı_olcutu_p/index.html # #1085: the same title change, under the slug the data artifact now uses
about/charity/gep/index.html # #973: redirect from the address printed in the GEP PDF to /about/charity/, not a page
data/glossary-terms.*.json # Build-time English glossary lookup, fetched on first term interaction (#227); not a page
cv/index.html # Retitled as a CV template in the content review (#1079). Exempts all its SEO tags: remove once main has the new title
@@ -131,3 +135,8 @@ about/cite-us/index.html # Hyphenated URL replacing /about/cite_us/ (old URL
about/cite_us/index.html # Now a Hugo alias redirect to /about/cite-us/, so it moves out of the plain-page structured-data count
talk/openday22/index.html # Hugo alias redirecting retired /talk/openday22/ links to /about/us/
data/nowherelab_members.json # Nowhere Lab member counts by country (static/data/nowherelab_members.json, built by scripts/build_nowherelab_map.py); remove once main has it
+vendor/assets/leaflet/1.5.1/images/layers-2x.png # Served the Leaflet map on /about/visitors/, which is now an SVG map (#1325)
+vendor/assets/leaflet/1.5.1/images/layers.png # Served the Leaflet map on /about/visitors/, which is now an SVG map (#1325)
+vendor/assets/leaflet/1.5.1/images/marker-icon.png # Served the Leaflet map on /about/visitors/, which is now an SVG map (#1325)
+vendor/assets/leaflet/1.5.1/leaflet.css # Served the Leaflet map on /about/visitors/, which is now an SVG map (#1325)
+vendor/assets/leaflet/1.5.1/leaflet.js # Served the Leaflet map on /about/visitors/, which is now an SVG map (#1325)
diff --git a/scripts/rebrand/compare_builds.py b/scripts/rebrand/compare_builds.py
index 03d28624c4b..bd0cd24d9c9 100644
--- a/scripts/rebrand/compare_builds.py
+++ b/scripts/rebrand/compare_builds.py
@@ -5,7 +5,8 @@
Fails if an address changes (a page, feed, sitemap or data file appears or goes),
if a structured-data count falls, or if a page's SEO tags change (except same-image
-WebP-to-PNG/JPEG social derivatives and their size/type tags). New assets such as
+WebP-to-PNG/JPEG social derivatives and their size/type tags, and main's default share
+image becoming a brick tray). New assets such as
fonts and bundles are listed and allowed. Agreed exceptions go in allowed_changes.txt
beside this script, one normalised path or glob per line, with a comment saying why. A glob
suits a collection whose size changes with the data, such as numbered pages.
@@ -143,6 +144,35 @@ def _equivalent_descriptions(before, after):
return before, after
+# The share image of a page without one of its own: main's single default, or one of the Doors brick trays, which
+# site_head.html picks by a hash of the page's path. Each with its own alt text.
+_OLD_DEFAULT_IMAGE = re.compile(r".*/img/forrt-share\.png")
+_OLD_DEFAULT_ALT = "FORRT - Framework for Open and Reproducible Research Training"
+_TRAY_IMAGE = re.compile(r".*/images/share/tray-[0-9]{2}_hu_?[0-9a-f]{8,}\.png")
+_TRAY_ALT = "The FORRT logo on a tray of studded bricks"
+
+
+def _without_default_images(before, after):
+ """Drop the default share images and their alt texts where main's default became a tray, and nothing else."""
+ def drop(tags, pattern, alt):
+ keys = ("og:image", "twitter:image")
+ images = {tag for tag in tags for key in keys if tag.startswith(key + "=") and pattern.fullmatch(tag[len(key) + 1:])}
+ alts = {f"{key}:alt={alt}" for key in keys}
+ if len(images) != len(keys) or not alts <= set(tags):
+ return None
+ return [tag for tag in tags if tag not in images | alts]
+
+ old, new = drop(before, _OLD_DEFAULT_IMAGE, _OLD_DEFAULT_ALT), drop(after, _TRAY_IMAGE, _TRAY_ALT)
+ return (before, after) if old is None or new is None else (old, new)
+
+
+def _with_new_organization_image(tags):
+ """The organisation's structured data on the home page carries the site's default image, which has a new file."""
+ old, new = '/img/forrt-share.png"', '/img/forrt-share-logo.png"'
+ return sorted(re.sub(r'("image":"[^"]*)' + re.escape(old), lambda m: m.group(1) + new, tag)
+ if '"@type":"EducationalOrganization"' in tag else tag for tag in tags)
+
+
def compare_heads(reference, candidate, allowed=frozenset()):
"""Return {path: (only_before, only_after)} for pages whose SEO tags differ."""
changes = {}
@@ -154,6 +184,8 @@ def compare_heads(reference, candidate, allowed=frozenset()):
after = _without_edit_date(candidate[path])
before, after = _equivalent_social_images(before, after)
before, after = _equivalent_descriptions(before, after)
+ before, after = _without_default_images(before, after)
+ before, after = _with_new_organization_image(before), sorted(after)
if before != after:
before, after = set(before), set(after)
changes[path] = (sorted(before - after), sorted(after - before))
diff --git a/scripts/tests/test_rebrand_checks.py b/scripts/tests/test_rebrand_checks.py
index aa303d24231..ef7a314a2cd 100644
--- a/scripts/tests/test_rebrand_checks.py
+++ b/scripts/tests/test_rebrand_checks.py
@@ -322,6 +322,38 @@ def test_png_jpeg_comparisons_and_unconverted_companions_stay_exact(self):
with self.subTest(suffix=suffix):
self.assertIn("a", compare_heads({"a": before}, {"a": after}))
+ def default_tags(self, image, alt):
+ return sorted([tag for tag in self.social_tags(image, "image/png") if ":alt=" not in tag]
+ + ["og:image:alt=" + alt, "twitter:image:alt=" + alt])
+
+ def test_the_default_share_image_may_become_a_brick_tray(self):
+ old_alt = "FORRT - Framework for Open and Reproducible Research Training"
+ new_alt = "The FORRT logo on a tray of studded bricks"
+ before = self.default_tags("https://forrt.org/rebrand-doors/img/forrt-share.png", old_alt)
+ tray = "https://forrt.org/rebrand-doors/images/share/tray-07_hu_0123456789abcdef.png"
+ after = self.default_tags(tray, new_alt)
+ self.assertEqual(compare_heads({"a": before}, {"a": after}), {})
+ for image, alt in ((tray.replace("tray-07", "logo"), new_alt), (tray, "Another text"),
+ (tray.replace("_hu_0123456789abcdef", ""), new_alt)):
+ with self.subTest(image=image, alt=alt):
+ self.assertIn("a", compare_heads({"a": before}, {"a": self.default_tags(image, alt)}))
+ # A page that had an image of its own must keep it, and nothing else may change along with the default.
+ own = self.default_tags("https://forrt.org/rebrand-doors/img/own.png", old_alt)
+ self.assertIn("a", compare_heads({"a": own}, {"a": after}))
+ for tag in ("title=Page", "og:image:width=100"):
+ with self.subTest(tag=tag):
+ changed = sorted(tag + "0" if other == tag else other for other in after)
+ self.assertIn("a", compare_heads({"a": before}, {"a": changed}))
+
+ def test_the_organization_image_may_become_the_new_default(self):
+ tag = '{"@type":"%s","image":"https://forrt.org/img/%s.png","name":"%s"}'
+ before = [tag % ("EducationalOrganization", "forrt-share", "FORRT")]
+ self.assertEqual(compare_heads({"a": before}, {"a": [tag % ("EducationalOrganization", "forrt-share-logo", "FORRT")]}), {})
+ self.assertIn("a", compare_heads({"a": before}, {"a": [tag % ("EducationalOrganization", "forrt-share-logo", "Other")]}))
+ self.assertIn("a", compare_heads({"a": before}, {"a": [tag % ("EducationalOrganization", "other", "FORRT")]}))
+ article = [tag % ("Article", "forrt-share", "FORRT")]
+ self.assertIn("a", compare_heads({"a": article}, {"a": [tag % ("Article", "forrt-share-logo", "FORRT")]}))
+
def test_duplicate_image_tags_are_not_normalized(self):
original = "https://example.org/img/source.webp"
before = sorted(self.social_tags(original) + ["og:image=" + original])