Skip to content

Commit c373396

Browse files
merch: per-product Open Graph preview (title/description/image); CI: drop temp branch trigger
- merch/product.php sets $og_title/$og_description (intro of the Printful catalog description) + $og_image (product mockup) so shared product links get a product-specific preview card (from closed PR #179's idea, ported to the current centralized OG system). - build-images.yml: remove the chore/reconcile-prod-drift trigger now that the branch is being reconciled into develop.
1 parent 7db7de2 commit c373396

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

.github/workflows/build-images.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
branches:
88
- develop
99
- master
10-
- chore/reconcile-prod-drift # TEMP: remove after this branch is merged
1110
tags:
1211
- "v*"
1312
workflow_dispatch:

merch/product.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,20 @@
185185
$default_size = $default_info['size'];
186186
$gallery = $apply_generated_mockups($gallery, $default_colour);
187187

188+
// Per-product Open Graph preview so a shared merch link shows the product's
189+
// image + blurb (header.php reads these $og_* globals).
190+
$og_title = $product->get_name();
191+
$__ogd = trim(strip_tags((string) $catalog_product->get_description()));
192+
if (preg_match('@^(.+?)•@ms', $__ogd, $__ogm)) { $__ogd = $__ogm[1]; }
193+
$__ogd = trim(preg_replace('/\s+/', ' ', $__ogd));
194+
if ($__ogd !== '') {
195+
if (function_exists('mb_strlen') && mb_strlen($__ogd) > 300) { $__ogd = mb_substr($__ogd, 0, 297) . ''; }
196+
$og_description = $__ogd;
197+
}
198+
if (!empty($gallery[0]['preview'])) {
199+
$__ogi = $gallery[0]['preview'];
200+
$og_image = (strpos($__ogi, 'http') === 0) ? $__ogi : 'https://www.untrobotics.com' . $__ogi;
201+
}
188202
head("Buy {$product->get_name()}", true);
189203
$category_name = strtolower(preg_replace('@^.*\(([^()]+)\)$@i', '$1', $product->get_name()));
190204
if($category_name !== 'gear' && $category_name[-1]!=='s'){

0 commit comments

Comments
 (0)