Skip to content

Commit dc0bfc0

Browse files
Shalom-Karrclaude
andcommitted
perf(top-of-page): fix reveal flash, inline header/footer JSON
Two stacked wins for first-paint speed on every page: 1. The .reveal animation no longer hides content by default. CSS used to apply opacity:0 to every .reveal element unconditionally, leaving the whole hero invisible for ~800ms until app.js could attach the IntersectionObserver and add .in. Above-the-fold content now paints immediately; app.js stamps .r-hide only on .reveal elements that are below the fold at first paint, then the observer fades them in as they scroll into view. prefers-reduced-motion users skip both. 2. header.json and footer.json are now inlined into every page as <script id="ota-header-data" type="application/json"> blocks at build time. header.js and footer.js read those inline blocks instead of fetching, removing a network round-trip on every load and letting the nav paint as soon as header.js is parsed. The old preload tags are gone (no fetch to preload). Both scripts fall back to fetch if the inline block is missing (older deploys, dev). Also fixes: admin footer editor showed "[object Object]" in the Phone field because the input was bound to the whole `phone` object instead of phone.label. Split into two inputs (label + tel: link). Docs: TROUBLESHOOTING.md now documents the changelog-bot push-rejection gotcha — on this repo, run git pull --rebase between every push because changelog.yml auto-commits on each push to main. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 29a18bb commit dc0bfc0

39 files changed

Lines changed: 184 additions & 88 deletions

docs/TROUBLESHOOTING.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,45 @@ and `wrangler pages secret bulk` both use `secret_text` by default.
309309
310310
---
311311
312+
## `git push` rejected — "remote contains work that you do not have locally"
313+
314+
### Symptom
315+
316+
You just committed a fix, push, and Git says:
317+
318+
```
319+
hint: Updates were rejected because the remote contains work that you
320+
hint: do not have locally...
321+
```
322+
323+
You didn't expect anyone else to be pushing.
324+
325+
### Why
326+
327+
`.github/workflows/changelog.yml` auto-commits a `CHANGELOG.md` update
328+
on every push to `main`. That commit (subject ends `[skip ci]`) lands
329+
on the remote within seconds of your push. Your next local push from
330+
the same branch is then non-fast-forward — the remote has the bot's
331+
commit, you don't.
332+
333+
### Fix
334+
335+
```bash
336+
git pull --rebase origin main
337+
git push origin main
338+
```
339+
340+
Don't force-push — the changelog commit is real work; rebasing
341+
preserves both. Build this into your workflow on this repo:
342+
343+
```bash
344+
git commit -m "..."
345+
git pull --rebase origin main # absorb the auto-changelog if any
346+
git push origin main
347+
```
348+
349+
---
350+
312351
## Conventions on this project
313352
314353
(things that aren't obvious from reading the code, learned the hard way)

website/aba-therapy-guide.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,8 @@
435435
<!-- auto-seo-end -->
436436
<!-- auto-perf-start -->
437437
<meta name="view-transition" content="same-origin">
438-
<link rel="preload" as="fetch" href="/assets/data/header.json">
439-
<link rel="preload" as="fetch" href="/assets/data/footer.json">
438+
<script id="ota-header-data" type="application/json">{"schemaVersion":1,"announcementBar":{"text":"NEW LOCATION IN CLEVELAND OPENING SOON!","linkLabel":"","linkHref":""},"logo":{"src":"/assets/images/footerImg.png","alt":"On Target ABA","href":"/"},"navLinks":[{"href":"/our-services.html","label":"Services","section":"Services"},{"href":"/autism-testing.html","label":"Autism Testing","section":"Autism Testing"},{"href":"/about.html","label":"About","section":"About"},{"href":"/insurance.html","label":"Insurance","section":"Insurance"},{"href":"/locations.html","label":"Locations","section":"Locations"},{"href":"/faqs.html","label":"FAQs","section":"FAQs"},{"href":"/careers.html","label":"Careers","section":"Careers"},{"href":"/blog.html","label":"Blog","section":"Blog"}],"cta":{"phone":{"href":"tel:8889895011","label":"(888) 989-5011"},"primary":{"href":"/contact.html","label":"Get Started"}},"breadcrumbs":{"/":null,"/about":[["Home","/"],["About",null]],"/our-process":[["Home","/"],["About","/about"],["Our Process",null]],"/our-services":[["Home","/"],["Services",null]],"/center-based-aba-therapy":[["Home","/"],["Services","/our-services"],["Center-Based ABA",null]],"/in-home-aba-therapy":[["Home","/"],["Services","/our-services"],["In-Home ABA",null]],"/early-intervention-autism-program":[["Home","/"],["Services","/our-services"],["Early Intervention",null]],"/potty-training-program":[["Home","/"],["Services","/our-services"],["Potty Training",null]],"/autism-testing":[["Home","/"],["Services","/our-services"],["Autism Testing",null]],"/locations":[["Home","/"],["Locations",null]],"/murray-utah":[["Home","/"],["Locations","/locations"],["Murray, UT",null]],"/mayfield-ohio":[["Home","/"],["Locations","/locations"],["Mayfield Village, OH",null]],"/gahanna-ohio":[["Home","/"],["Locations","/locations"],["Gahanna, OH",null]],"/worthington-ohio":[["Home","/"],["Locations","/locations"],["Worthington, OH",null]],"/insurance":[["Home","/"],["Insurance",null]],"/faqs":[["Home","/"],["FAQs",null]],"/careers":[["Home","/"],["Careers",null]],"/job-application":[["Home","/"],["Careers","/careers"],["Job Application",null]],"/employment-application":[["Home","/"],["Careers","/careers"],["Employment Application",null]],"/contact":[["Home","/"],["Contact",null]],"/pre-intake-form":[["Home","/"],["Contact","/contact"],["Pre-Intake Form",null]],"/aba-therapy-guide":[["Home","/"],["Resources",null],["ABA Therapy Guide",null]],"/blog":[["Home","/"],["Blog",null]],"/blog/post":[["Home","/"],["Blog","/blog"],["Article",null]],"/privacy-policy":[["Home","/"],["Legal",null],["Privacy Policy",null]],"/terms-of-service":[["Home","/"],["Legal",null],["Terms of Service",null]],"/cookie-consent":[["Home","/"],["Legal",null],["Cookies",null]],"/disclaimer":[["Home","/"],["Legal",null],["Disclaimer",null]],"/icon-attribution":[["Home","/"],["Legal",null],["Icon Attribution",null]],"/thank-you":null,"/thank-you-confirmation":null},"activeSectionMap":{"/our-services":"Services","/center-based-aba-therapy":"Services","/in-home-aba-therapy":"Services","/early-intervention-autism-program":"Services","/potty-training-program":"Services","/autism-testing":"Autism Testing","/about":"About","/our-process":"About","/insurance":"Insurance","/locations":"Locations","/murray-utah":"Locations","/mayfield-ohio":"Locations","/gahanna-ohio":"Locations","/worthington-ohio":"Locations","/faqs":"FAQs","/careers":"Careers","/job-application":"Careers","/employment-application":"Careers","/blog":"Blog"}}</script>
439+
<script id="ota-footer-data" type="application/json">{"schemaVersion":1,"logo":{"src":"/assets/images/footerImg.png","alt":"On Target ABA"},"tagline":"Compassionate, evidence-based ABA therapy and autism evaluations. Quality care without the wait.","phone":{"href":"tel:8889895011","label":"1-888-989-5011"},"columns":[{"title":"Services","links":[{"href":"/center-based-aba-therapy.html","label":"Center-Based ABA"},{"href":"/in-home-aba-therapy.html","label":"In-Home ABA"},{"href":"/early-intervention-autism-program.html","label":"Early Intervention"},{"href":"/potty-training-program.html","label":"Potty Training"},{"href":"/autism-testing.html","label":"Autism Testing"}]},{"title":"Company","links":[{"href":"/about.html","label":"About"},{"href":"/our-process.html","label":"Our Process"},{"href":"/locations.html","label":"Locations"},{"href":"/careers.html","label":"Careers"},{"href":"/blog.html","label":"Blog"}]},{"title":"Resources","links":[{"href":"/aba-therapy-guide.html","label":"ABA Therapy Guide"},{"href":"/insurance.html","label":"Insurance"},{"href":"/faqs.html","label":"FAQs"},{"href":"/contact.html","label":"Contact"},{"href":"/pre-intake-form.html","label":"Pre-Intake Form"}]},{"title":"Locations","links":[{"href":"/murray-utah.html","label":"Utah | Murray, UT"},{"href":"/mayfield-ohio.html","label":"Cleveland | Mayfield Village, OH"},{"href":"/gahanna-ohio.html","label":"Columbus | Gahanna, OH"},{"href":"/worthington-ohio.html","label":"Worthington | Worthington, OH"}]}],"credit":{"url":"https://shalomkarr.pages.dev/","name":"Shalom Karr"},"copyright":"\u00a9 ON TARGET ABA, LLC \u00b7 All rights reserved \u00b7 Operated by Target ABA, LLC","legalLinks":[{"href":"/privacy-policy.html","label":"Privacy"},{"href":"/terms-of-service.html","label":"Terms"},{"href":"/cookie-consent.html","label":"Cookies"},{"href":"/disclaimer.html","label":"Disclaimer"}]}</script>
440440
<link rel="prefetch" href="/contact.html">
441441
<link rel="prefetch" href="/our-services.html">
442442
<link rel="prefetch" href="/autism-testing.html">

website/about.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,8 @@
415415
<!-- auto-seo-end -->
416416
<!-- auto-perf-start -->
417417
<meta name="view-transition" content="same-origin">
418-
<link rel="preload" as="fetch" href="/assets/data/header.json">
419-
<link rel="preload" as="fetch" href="/assets/data/footer.json">
418+
<script id="ota-header-data" type="application/json">{"schemaVersion":1,"announcementBar":{"text":"NEW LOCATION IN CLEVELAND OPENING SOON!","linkLabel":"","linkHref":""},"logo":{"src":"/assets/images/footerImg.png","alt":"On Target ABA","href":"/"},"navLinks":[{"href":"/our-services.html","label":"Services","section":"Services"},{"href":"/autism-testing.html","label":"Autism Testing","section":"Autism Testing"},{"href":"/about.html","label":"About","section":"About"},{"href":"/insurance.html","label":"Insurance","section":"Insurance"},{"href":"/locations.html","label":"Locations","section":"Locations"},{"href":"/faqs.html","label":"FAQs","section":"FAQs"},{"href":"/careers.html","label":"Careers","section":"Careers"},{"href":"/blog.html","label":"Blog","section":"Blog"}],"cta":{"phone":{"href":"tel:8889895011","label":"(888) 989-5011"},"primary":{"href":"/contact.html","label":"Get Started"}},"breadcrumbs":{"/":null,"/about":[["Home","/"],["About",null]],"/our-process":[["Home","/"],["About","/about"],["Our Process",null]],"/our-services":[["Home","/"],["Services",null]],"/center-based-aba-therapy":[["Home","/"],["Services","/our-services"],["Center-Based ABA",null]],"/in-home-aba-therapy":[["Home","/"],["Services","/our-services"],["In-Home ABA",null]],"/early-intervention-autism-program":[["Home","/"],["Services","/our-services"],["Early Intervention",null]],"/potty-training-program":[["Home","/"],["Services","/our-services"],["Potty Training",null]],"/autism-testing":[["Home","/"],["Services","/our-services"],["Autism Testing",null]],"/locations":[["Home","/"],["Locations",null]],"/murray-utah":[["Home","/"],["Locations","/locations"],["Murray, UT",null]],"/mayfield-ohio":[["Home","/"],["Locations","/locations"],["Mayfield Village, OH",null]],"/gahanna-ohio":[["Home","/"],["Locations","/locations"],["Gahanna, OH",null]],"/worthington-ohio":[["Home","/"],["Locations","/locations"],["Worthington, OH",null]],"/insurance":[["Home","/"],["Insurance",null]],"/faqs":[["Home","/"],["FAQs",null]],"/careers":[["Home","/"],["Careers",null]],"/job-application":[["Home","/"],["Careers","/careers"],["Job Application",null]],"/employment-application":[["Home","/"],["Careers","/careers"],["Employment Application",null]],"/contact":[["Home","/"],["Contact",null]],"/pre-intake-form":[["Home","/"],["Contact","/contact"],["Pre-Intake Form",null]],"/aba-therapy-guide":[["Home","/"],["Resources",null],["ABA Therapy Guide",null]],"/blog":[["Home","/"],["Blog",null]],"/blog/post":[["Home","/"],["Blog","/blog"],["Article",null]],"/privacy-policy":[["Home","/"],["Legal",null],["Privacy Policy",null]],"/terms-of-service":[["Home","/"],["Legal",null],["Terms of Service",null]],"/cookie-consent":[["Home","/"],["Legal",null],["Cookies",null]],"/disclaimer":[["Home","/"],["Legal",null],["Disclaimer",null]],"/icon-attribution":[["Home","/"],["Legal",null],["Icon Attribution",null]],"/thank-you":null,"/thank-you-confirmation":null},"activeSectionMap":{"/our-services":"Services","/center-based-aba-therapy":"Services","/in-home-aba-therapy":"Services","/early-intervention-autism-program":"Services","/potty-training-program":"Services","/autism-testing":"Autism Testing","/about":"About","/our-process":"About","/insurance":"Insurance","/locations":"Locations","/murray-utah":"Locations","/mayfield-ohio":"Locations","/gahanna-ohio":"Locations","/worthington-ohio":"Locations","/faqs":"FAQs","/careers":"Careers","/job-application":"Careers","/employment-application":"Careers","/blog":"Blog"}}</script>
419+
<script id="ota-footer-data" type="application/json">{"schemaVersion":1,"logo":{"src":"/assets/images/footerImg.png","alt":"On Target ABA"},"tagline":"Compassionate, evidence-based ABA therapy and autism evaluations. Quality care without the wait.","phone":{"href":"tel:8889895011","label":"1-888-989-5011"},"columns":[{"title":"Services","links":[{"href":"/center-based-aba-therapy.html","label":"Center-Based ABA"},{"href":"/in-home-aba-therapy.html","label":"In-Home ABA"},{"href":"/early-intervention-autism-program.html","label":"Early Intervention"},{"href":"/potty-training-program.html","label":"Potty Training"},{"href":"/autism-testing.html","label":"Autism Testing"}]},{"title":"Company","links":[{"href":"/about.html","label":"About"},{"href":"/our-process.html","label":"Our Process"},{"href":"/locations.html","label":"Locations"},{"href":"/careers.html","label":"Careers"},{"href":"/blog.html","label":"Blog"}]},{"title":"Resources","links":[{"href":"/aba-therapy-guide.html","label":"ABA Therapy Guide"},{"href":"/insurance.html","label":"Insurance"},{"href":"/faqs.html","label":"FAQs"},{"href":"/contact.html","label":"Contact"},{"href":"/pre-intake-form.html","label":"Pre-Intake Form"}]},{"title":"Locations","links":[{"href":"/murray-utah.html","label":"Utah | Murray, UT"},{"href":"/mayfield-ohio.html","label":"Cleveland | Mayfield Village, OH"},{"href":"/gahanna-ohio.html","label":"Columbus | Gahanna, OH"},{"href":"/worthington-ohio.html","label":"Worthington | Worthington, OH"}]}],"credit":{"url":"https://shalomkarr.pages.dev/","name":"Shalom Karr"},"copyright":"\u00a9 ON TARGET ABA, LLC \u00b7 All rights reserved \u00b7 Operated by Target ABA, LLC","legalLinks":[{"href":"/privacy-policy.html","label":"Privacy"},{"href":"/terms-of-service.html","label":"Terms"},{"href":"/cookie-consent.html","label":"Cookies"},{"href":"/disclaimer.html","label":"Disclaimer"}]}</script>
420420
<link rel="prefetch" href="/contact.html">
421421
<link rel="prefetch" href="/our-services.html">
422422
<link rel="prefetch" href="/autism-testing.html">

website/admin/footer.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ <h1 class="admin-h1">Footer</h1>
7373
<div class="field"><label>Logo src</label><input class="input" data-bind="logo.src" type="text"></div>
7474
<div class="field"><label>Logo alt</label><input class="input" data-bind="logo.alt" type="text"></div>
7575
<div class="field" style="grid-column:1/-1;"><label>Tagline</label><input class="input" data-bind="tagline" type="text"></div>
76-
<div class="field"><label>Phone</label><input class="input" data-bind="phone" type="text"></div>
76+
<div class="field"><label>Phone (display label)</label><input class="input" data-bind="phone.label" type="text" placeholder="1-888-989-5011"></div>
77+
<div class="field"><label>Phone (tel: link)</label><input class="input" data-bind="phone.href" type="text" placeholder="tel:8889895011"></div>
7778
</div>
7879
</section>
7980

website/assets/css/app.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,17 @@ body {
203203
.blob-teal { background: var(--c-teal); }
204204

205205
/* =========== Scroll-reveal =========== */
206+
/* `.reveal` is no longer hidden by default. app.js stamps `.r-hide` on
207+
elements that are below the fold at first paint, then the observer
208+
removes it via `.in`. Above-the-fold content paints immediately. */
206209
.reveal {
207-
opacity: 0;
208-
transform: translateY(24px);
209210
transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1);
210211
will-change: opacity, transform;
211212
}
213+
.reveal.r-hide {
214+
opacity: 0;
215+
transform: translateY(24px);
216+
}
212217
.reveal.in {
213218
opacity: 1;
214219
transform: translateY(0);

website/assets/js/app.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@
1313
'use strict';
1414

1515
// ---------- Scroll reveal ----------
16+
// We don't hide .reveal in CSS — above-the-fold content paints
17+
// immediately. Here we stamp `.r-hide` only on elements that are
18+
// below the fold at first paint, and the observer removes it via
19+
// `.in` as they enter the viewport.
20+
const reducedMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
21+
const fold = window.innerHeight + 80;
22+
document.querySelectorAll('.reveal').forEach((el) => {
23+
if (!reducedMotion && el.getBoundingClientRect().top > fold) {
24+
el.classList.add('r-hide');
25+
}
26+
});
27+
1628
const io = new IntersectionObserver((entries) => {
1729
entries.forEach((e) => {
1830
if (e.isIntersecting) {

website/assets/js/footer.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,22 @@
107107
);
108108
}
109109

110-
fetch('/assets/data/footer.json', { credentials: 'same-origin' })
111-
.then((r) => {
112-
if (!r.ok) throw new Error('footer.json ' + r.status);
113-
return r.json();
114-
})
110+
// Prefer footer data inlined at build time by scripts/optimize-pages.py.
111+
// Falls back to a real fetch if no inline block (older deploys etc).
112+
function loadFooterData() {
113+
const inline = document.getElementById('ota-footer-data');
114+
if (inline && inline.textContent.trim()) {
115+
try { return Promise.resolve(JSON.parse(inline.textContent)); }
116+
catch (e) { /* fall through to fetch */ }
117+
}
118+
return fetch('/assets/data/footer.json', { credentials: 'same-origin' })
119+
.then((r) => {
120+
if (!r.ok) throw new Error('footer.json ' + r.status);
121+
return r.json();
122+
});
123+
}
124+
125+
loadFooterData()
115126
.then((data) => {
116127
slot.outerHTML = render(data);
117128
document.querySelectorAll('[data-year]').forEach((el) => {

website/assets/js/header.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,23 @@
182182
);
183183
}
184184

185-
fetch('/assets/data/header.json', { credentials: 'same-origin' })
186-
.then((r) => {
187-
if (!r.ok) throw new Error('header.json ' + r.status);
188-
return r.json();
189-
})
185+
// Prefer header data inlined at build time by scripts/optimize-pages.py
186+
// (no network round-trip). Fall back to fetch if the inline block was
187+
// stripped (older deploys, dev preview, etc).
188+
function loadHeaderData() {
189+
const inline = document.getElementById('ota-header-data');
190+
if (inline && inline.textContent.trim()) {
191+
try { return Promise.resolve(JSON.parse(inline.textContent)); }
192+
catch (e) { /* fall through to fetch */ }
193+
}
194+
return fetch('/assets/data/header.json', { credentials: 'same-origin' })
195+
.then((r) => {
196+
if (!r.ok) throw new Error('header.json ' + r.status);
197+
return r.json();
198+
});
199+
}
200+
201+
loadHeaderData()
190202
.then((headerData) => {
191203
const navLinks = headerData.navLinks || [];
192204
const html =

0 commit comments

Comments
 (0)