Addresses real gaps found in testing (a Macedonian question on an English page returned nothing): - Detect the language of the QUESTION (Cyrillic -> MK; Slovene markers -> SI; else the page language) and load that language's index + curated answers. Fixes cross-language questions. - Expand curated multilingual intents (now incl. enrolment/eVŠ, deadlines, health, "what is MSOS", etc.) with stem keywords for better paraphrase matching. MK/SI answers machine-drafted — proofread before launch. - Suggested-question chips on open (localized) to guide users. - Privacy-safe analytics: fire a GA4 'assistant_query' event ONLY after the visitor accepts cookies (q text, result type, question vs page language) so the team can see real FAQs and unanswered questions. - Move the widget to bottom-left on pages with the floating "Become a member" CTA so they never overlap. Design polish (chips, typing dots, launcher pulse). - CI: rebuild the search index on every deploy (setup-python + build script) so the assistant stays in sync with content automatically. Build script is now path-portable (no hardcoded path). Verified in a headless browser: MK-on-EN now answers correctly, chips work, analytics event fires only with consent, become-a-member offset applies, zero console errors. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| README.md | ||
| build_search_index.py | ||
| seo_inject.py | ||
README.md
tools/
seo_inject.py
Injects a technical-SEO block into every language page (en|mk|si/**/index.html)
and regenerates sitemap.xml + robots.txt. Safe to re-run — the block lives
between <!-- SEO:START --> and <!-- SEO:END --> and is replaced in place.
The block adds: meta description (auto-extracted from the page's lead/subtitle
where available), canonical, hreflang alternates (en / mk / sl / x-default),
Open Graph, Twitter Card, and an Organization JSON-LD.
All absolute URLs point at the final domain https://msosorg.com (not the
temporary host), so nothing needs rewriting at launch. Note: the Slovene folder
is /si/ but the ISO code is sl — the script maps si → sl for hreflang/locale.
Usage
python tools/seo_inject.py # dry run: print the block for pilot pages
python tools/seo_inject.py --all # write the block into every page
python tools/seo_inject.py --all --sitemap # also rebuild sitemap.xml + robots.txt
Run --all --sitemap after adding, renaming, or deleting any page so canonical
tags, hreflang alternates, and the sitemap stay in sync.