Skip to content

Load Tito widget on homepage only and source ticket prices from Tito - #164

Merged
matrixise merged 2 commits into
mainfrom
tito-widget-homepage-only
Nov 18, 2026
Merged

matrixise merged 2 commits into
mainfrom
tito-widget-homepage-only

Conversation

@matrixise

@matrixise matrixise commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Tito script only where the widget is. https://js.tito.io/v2 was loaded from head.html on every page (~10 JS/CSS requests on /schedule/, /speakers/, blog posts…). It is now emitted in <head> only when .IsHome (the only page rendering the widget). An earlier revision placed it in <body> next to the widget, but that left the widget empty in some Firefox setups, so it stays in <head>.
  • Tito is the single source of truth for tickets. New partials/tito-data.html fetches https://checkout.tito.io/<account>/<event>.json (the same public endpoint the widget uses) at build time via resources.GetRemote. It feeds:
    • the homepage "Tickets from €X to €Y" line,
    • the Event JSON-LD offers: one Offer per Tito release with real availability (on_sale → InStock, sold_out → SoldOut, upcoming → PreOrder). Previously this was an AggregateOffer hardcoded to PreOrder while tickets were on sale.
  • No more hardcoded slug. The <tito-widget event="…"> value is derived from params.ticketsUrl.
  • Removed [[params.tickets]] from hugo.toml: duplicated prices plus features lists that were no longer displayed and advertised perks not offered on Tito.
  • rel="me" removed from the Tito link (it is an identity-verification attribute).
  • CSP guard: Tito declared in csp-dynamic-loaders.yml (style-src, frame-src js.tito.io; connect-src checkout.tito.io). No CSP change needed.
  • [caches.getresource] maxAge = "1h" so hugo server does not keep stale prices forever (Hugo's default is to cache remote resources indefinitely).

Failure mode

If Tito is unreachable or the slug is wrong, the build does not fail: a WARN tito-data: … is logged, the price line and the offers block are omitted, and the widget still renders.

Verification

  • hugo --minify builds; homepage shows Tickets from €35 to €159; JSON-LD contains 3 Offers (Corporate 159, General 59, Student 35), all InStock.
  • With HUGO_PARAMS_TICKETSURL=https://ti.to/python-ireland/does-not-exist: warning logged, no price line, no offers, build succeeds.
  • Headless browser: 0 Tito requests on /schedule/ and /blog/; widget loads on /.
  • scripts/check-csp.py --verbose (with pyyaml): passes, including the 3 new Tito dynamic-loader pairs.

Note: the checkout overlay only opens on origins allowed in the Tito dashboard (2026.pycon.ie). On localhost and likely on the deploy preview, the widget renders but "Continue" does nothing. This is expected and unrelated to this change. Please check checkout on production after merge.

🤖 Generated with Claude Code

- Move the js.tito.io script from head.html (every page) into
  partials/tickets.html, next to the widget, so other pages no longer
  download ~10 Tito JS/CSS files
- Add partials/tito-data.html: fetch ticket names, prices and sale state
  from Tito's public checkout endpoint at build time; a Tito outage or
  bad slug logs a warning and hides prices instead of failing the build
- Derive the widget event slug from params.ticketsUrl instead of
  hardcoding it
- Homepage price range now comes from Tito
- Event JSON-LD: one Offer per Tito release with real availability
  (InStock/SoldOut/PreOrder) instead of an AggregateOffer hardcoded to
  PreOrder
- Remove [[params.tickets]] from hugo.toml (stale prices and features
  not offered on Tito); cap the getresource cache at 1h
- Drop rel="me" from the Tito link (identity-verification attribute)
- Declare Tito in csp-dynamic-loaders.yml (style-src, frame-src,
  connect-src) so the CSP checker guards the widget
- Update CLAUDE.md accordingly
@netlify

netlify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for pycon-ireland-2026 ready!

Name Link
🔨 Latest commit d24ba3d
🔍 Latest deploy log https://app.netlify.com/projects/pycon-ireland-2026/deploys/6afe0154dad48cb4d7115f98
😎 Deploy Preview https://deploy-preview-164--pycon-ireland-2026.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Loading js.tito.io next to the widget in <body> left the widget empty in
some Firefox setups (reproduced on the deploy preview, while the same
browser renders it fine when the script is in <head>). Keep the script
in <head>, but only on the homepage, which is the only page rendering
the widget.
@matrixise
matrixise merged commit 0415173 into main Nov 18, 2026
6 checks passed
@matrixise
matrixise deleted the tito-widget-homepage-only branch November 18, 2026 19:54
matrixise added a commit that referenced this pull request Nov 18, 2026
The Tito widget script runs vue-router in the host page. It listens to
popstate, which a native fragment navigation fires, and then calls
window.scrollTo(0, 0). On the homepage, clicking "Tickets" in the menu
(/#tickets) or the hero price link (#tickets) left Firefox at the top of
the page.

- nav.html: intercept left-clicks on same-page anchor links, scroll to
  the target with scrollIntoView and update the URL with pushState,
  which does not fire popstate
- Close the mobile menu when such a link is clicked inside it
- CLAUDE.md: tickets.html no longer loads the Tito script (it is in
  head.html on the homepage only since #164); document the workaround
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant