From 195a48205c83e12a28da40edb1517b74b37aa7d2 Mon Sep 17 00:00:00 2001 From: popovskik Date: Wed, 5 Aug 2026 16:20:55 +0200 Subject: [PATCH] changes.txt #6: sync homepage "Latest news" from the News hub Add tools/build_listings.py: copies the top 3 cards from each language's News hub into the homepage "Latest news" block (marker-wrapped), so editing the News page now updates the homepage. The News hub stays the hand-edited source of truth (it may hold curated teaser cards without a detail page). Also: fix the Gallery meta description (was a copy of the FAQ text) and add a durable gallery override to seo_inject.py; refresh llms.txt / links-for-bots. Co-Authored-By: Claude Opus 4.8 (1M context) --- en/gallery/index.html | 6 +-- en/index.html | 2 + links-for-bots/index.html | 6 +-- llms.txt | 2 +- mk/gallery/index.html | 6 +-- mk/index.html | 2 + si/gallery/index.html | 6 +-- si/index.html | 2 + tools/build_listings.py | 80 +++++++++++++++++++++++++++++++++++++++ tools/seo_inject.py | 5 +++ 10 files changed, 104 insertions(+), 13 deletions(-) create mode 100644 tools/build_listings.py diff --git a/en/gallery/index.html b/en/gallery/index.html index f087ac15..36e74f0a 100644 --- a/en/gallery/index.html +++ b/en/gallery/index.html @@ -22,7 +22,7 @@ gtag('config', 'G-WVYV807VSS'); - + @@ -31,7 +31,7 @@ - + @@ -39,7 +39,7 @@ - + diff --git a/en/index.html b/en/index.html index 79c600ef..b426fd77 100644 --- a/en/index.html +++ b/en/index.html @@ -307,6 +307,7 @@

What is new at MSOS, from events and projects to blog stories and announcements.

+ See all diff --git a/links-for-bots/index.html b/links-for-bots/index.html index 92c888c9..cb3ce694 100644 --- a/links-for-bots/index.html +++ b/links-for-bots/index.html @@ -34,7 +34,7 @@
  • MSOS Hub — Discover the MSOS Hub in Ljubljana — the community space of the Macedonian Student Organisation in Slovenia for events, gatherings and student life.
  • Become a member — Join MSOS and find your people in Slovenia. Meet students, attend events, get support and help create projects across the Macedonian student community.
  • Support MSOS — Support the Macedonian Student Organisation in Slovenia (MSOS) through a donation or partnership and help fund student events, guidance and community programs.
  • -
  • Gallery — Short answers to the questions Macedonian students ask most about studying and living in Slovenia, applications, residence, work, housing and more.
  • +
  • Gallery — A look back at the events, gatherings and moments that make the MSOS community — browse photo albums from Macedonian student life in Slovenia.
  • Frequently asked questions — Short answers to the questions Macedonian students ask most about studying and living in Slovenia, applications, residence, work, housing and more.
  • Timeline & Milestones — Learn more about the company and the team behind it.
  • Official information — Official information about the Macedonian Student Organisation in Slovenia (MSOS): legal registration data, tax number, IBAN and contact details.
  • @@ -133,7 +133,7 @@
  • МСОС Хаб - Македонска студентска организација во Словенија — Запознајте го MSOS Hub во Љубљана — просторот на заедницата на Македонската студентска организација во Словенија за настани и студентски живот.
  • Стани член — Придружете се на МСОС и најдете ги вашите луѓе во Словенија. Запознајте студенти, посетувајте настани, добијте поддршка и создавајте проекти во македонската студентска заедница.
  • Поддржи го МСОС - Македонска студентска организација во Словенија — Поддржете ја Македонската студентска организација во Словенија (МСОС) со донација или партнерство и помогнете во финансирањето на студентските активности.
  • -
  • Галерија — Кратки одговори на прашањата што најчесто ги поставуваат македонските студенти за студирање и живеење во Словенија, пријави, престој, работа, сместување и повеќе.
  • +
  • Галерија — Поглед наназад на настаните, дружењата и моментите што ја градат заедницата на МСОС — прелистајте фото-албуми од македонскиот студентски живот во Словенија.
  • Често поставувани прашања — Кратки одговори на прашањата што најчесто ги поставуваат македонските студенти за студирање и живеење во Словенија, пријави, престој, работа, сместување и повеќе.
  • Времеплов и достигнувања - МСОС — Дознајте повеќе за организацијата и тимот зад неа.
  • Официјални информации - Македонска студентска организација во Словенија — Официјални информации за Македонската студентска организација во Словенија (МСОС): регистрациски податоци, даночен број, IBAN и контакт.
  • @@ -232,7 +232,7 @@
  • MSOS Hub - Makedonska študentska organizacija v Sloveniji — Spoznajte MSOS Hub v Ljubljani — prostor skupnosti Makedonske študentske organizacije v Sloveniji za dogodke in študentsko življenje.
  • Postani član — Pridružite se MSOS in najdite svoje ljudi v Sloveniji. Spoznajte študente, obiskujte dogodke, prejmite podporo in soustvarjajte projekte makedonske študentske skupnosti.
  • Podpri MSOS - Makedonska študentska organizacija v Sloveniji — Podprite Makedonsko študentsko organizacijo v Sloveniji (MSOS) z donacijo ali partnerstvom in pomagajte financirati študentske dogodke in programe.
  • -
  • Galerija — Kratki odgovori na vprašanja, ki jih makedonski študenti najpogosteje postavljajo o študiju in življenju v Sloveniji, prijave, prebivanje, delo, nastanitev in več.
  • +
  • Galerija — Pogled nazaj na dogodke, druženja in trenutke, ki gradijo skupnost MSOS — prebrskajte foto-albume iz makedonskega študentskega življenja v Sloveniji.
  • Pogosta vprašanja — Kratki odgovori na vprašanja, ki jih makedonski študenti najpogosteje postavljajo o študiju in življenju v Sloveniji, prijave, prebivanje, delo, nastanitev in več.
  • Časovnica in dosežki — Spoznajte več o organizaciji in ekipi, ki stoji za njo.
  • Uradni podatki - Makedonska študentska organizacija v Sloveniji — Uradni podatki o Makedonski študentski organizaciji v Sloveniji (MSOS): registracijski podatki, davčna številka, IBAN in kontakt.
  • diff --git a/llms.txt b/llms.txt index 6dc6968e..9883e8fc 100644 --- a/llms.txt +++ b/llms.txt @@ -10,7 +10,7 @@ Full multilingual crawl index (EN/MK/SI): https://msosorg.com/links-for-bots/ - [MSOS Hub](https://msosorg.com/en/msos-hub/): Discover the MSOS Hub in Ljubljana — the community space of the Macedonian Student Organisation in Slovenia for events, gatherings and student life. - [Become a member](https://msosorg.com/en/become-a-member/): Join MSOS and find your people in Slovenia. Meet students, attend events, get support and help create projects across the Macedonian student community. - [Support MSOS](https://msosorg.com/en/support/): Support the Macedonian Student Organisation in Slovenia (MSOS) through a donation or partnership and help fund student events, guidance and community programs. -- [Gallery](https://msosorg.com/en/gallery/): Short answers to the questions Macedonian students ask most about studying and living in Slovenia, applications, residence, work, housing and more. +- [Gallery](https://msosorg.com/en/gallery/): A look back at the events, gatherings and moments that make the MSOS community — browse photo albums from Macedonian student life in Slovenia. - [Frequently asked questions](https://msosorg.com/en/faq/): Short answers to the questions Macedonian students ask most about studying and living in Slovenia, applications, residence, work, housing and more. - [Timeline & Milestones](https://msosorg.com/en/timeline-and-milestones/): Learn more about the company and the team behind it. - [Official information](https://msosorg.com/en/legal/): Official information about the Macedonian Student Organisation in Slovenia (MSOS): legal registration data, tax number, IBAN and contact details. diff --git a/mk/gallery/index.html b/mk/gallery/index.html index ca8e0c70..95efcda2 100644 --- a/mk/gallery/index.html +++ b/mk/gallery/index.html @@ -22,7 +22,7 @@ gtag('config', 'G-WVYV807VSS'); - + @@ -31,7 +31,7 @@ - + @@ -39,7 +39,7 @@ - + diff --git a/mk/index.html b/mk/index.html index a76b5bd1..7c9d34d9 100644 --- a/mk/index.html +++ b/mk/index.html @@ -310,6 +310,7 @@

    Што е ново кај МСОС, од настани и проекти до блог приказни и објави.

    + Види ги сите diff --git a/si/gallery/index.html b/si/gallery/index.html index 666321ee..77c73b0b 100644 --- a/si/gallery/index.html +++ b/si/gallery/index.html @@ -22,7 +22,7 @@ gtag('config', 'G-WVYV807VSS'); - + @@ -31,7 +31,7 @@ - + @@ -39,7 +39,7 @@ - + diff --git a/si/index.html b/si/index.html index 8cdfd24e..4ee2660f 100644 --- a/si/index.html +++ b/si/index.html @@ -310,6 +310,7 @@

    Kaj je novega pri MSOS, od dogodkov in projektov do blog zgodb in obvestil.

    + Poglej vse diff --git a/tools/build_listings.py b/tools/build_listings.py new file mode 100644 index 00000000..3862c753 --- /dev/null +++ b/tools/build_listings.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +""" +build_listings.py -- keep the homepage "Latest news" in sync with the News hub. + +Problem it solves: the landing page's "Latest news" block used to be a separate +hard-coded copy, so editing the News page never updated the homepage. + +Source of truth = each language's News hub (`/news/index.html`), which is +edited by hand (it may include curated teaser cards without a detail page). +This script copies the first 3 News-hub cards into the homepage's "Latest news" +block, converting them to the homepage card format and fixing relative paths. + +Run after editing any News page: + + python tools/build_listings.py + +Idempotent and safe to re-run. The homepage block is wrapped in + markers. +""" +import io, os, re + +ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +LANGS = ("en", "mk", "si") +N_LATEST = 3 + +CARD_RE = re.compile(r'
    ', re.DOTALL) +EXCERPT_RE = re.compile(r'\s*

    .*?

    ', re.DOTALL) +# homepage .news-articles content, anchored by the trailing "See all" button +LANDING_RE = re.compile( + r'(
    )(.*?)(
    \s*)', + re.DOTALL, +) + + +def hub_to_landing(card): + """Convert one News-hub card to the homepage news-card format.""" + card = EXCERPT_RE.sub("", card) # homepage cards have no excerpt + card = (card + .replace('class="newshub-card"', 'class="news-card"') + .replace('class="newshub-media"', 'class="news-card-media"') + .replace('class="newshub-body"', 'class="card-content"') + .replace('class="newshub-date"', 'class="author"')) + # homepage is one directory shallower than the News hub + card = card.replace('href="../../', 'href="../').replace('src="../../', 'src="../') + return card.strip() + + +def sync_lang(lang): + hub_path = os.path.join(ROOT, lang, "news", "index.html") + home_path = os.path.join(ROOT, lang, "index.html") + if not (os.path.exists(hub_path) and os.path.exists(home_path)): + print(f" [{lang}] skipped (missing news hub or homepage)") + return 0 + + hub = io.open(hub_path, encoding="utf-8").read() + cards = CARD_RE.findall(hub)[:N_LATEST] + if not cards: + print(f" [{lang}] no News-hub cards found") + return 0 + + inner = "\n".join(" " + hub_to_landing(c) for c in cards) + block = ("\n \n" + f"{inner}\n" + " \n ") + + home = io.open(home_path, encoding="utf-8").read() + if not LANDING_RE.search(home): + print(f" [{lang}] could not find the homepage 'Latest news' block") + return 0 + home = LANDING_RE.sub(lambda m: m.group(1) + block + m.group(3), home, count=1) + io.open(home_path, "w", encoding="utf-8", newline="").write(home) + print(f" [{lang}] homepage 'Latest news' <- {len(cards)} cards from the News hub") + return len(cards) + + +if __name__ == "__main__": + print("Syncing homepage 'Latest news' from each News hub:") + total = sum(sync_lang(l) for l in LANGS) + print(f"Done ({total} cards written).") diff --git a/tools/seo_inject.py b/tools/seo_inject.py index 810fab6b..03c6ad25 100644 --- a/tools/seo_inject.py +++ b/tools/seo_inject.py @@ -151,6 +151,11 @@ DESC_OVERRIDES = { "mk": "Кратки одговори на прашањата што најчесто ги поставуваат македонските студенти за студирање и живеење во Словенија — пријави, престој, работа, сместување и повеќе.", "si": "Kratki odgovori na vprašanja, ki jih makedonski študenti najpogosteje postavljajo o študiju in življenju v Sloveniji — prijave, prebivanje, delo, nastanitev in več.", }, + "gallery": { + "en": "A look back at the events, gatherings and moments that make the MSOS community — browse photo albums from Macedonian student life in Slovenia.", + "mk": "Поглед наназад на настаните, дружењата и моментите што ја градат заедницата на МСОС — прелистајте фото-албуми од македонскиот студентски живот во Словенија.", + "si": "Pogled nazaj na dogodke, druženja in trenutke, ki gradijo skupnost MSOS — prebrskajte foto-albume iz makedonskega študentskega življenja v Sloveniji.", + }, "news": { "en": "Everything new at MSOS in one place — events and projects, blog stories, announcements and official updates for Macedonian students in Slovenia.", "mk": "Сè ново кај МСОС на едно место — настани и проекти, блог приказни, соопштенија и официјални новости за македонските студенти во Словенија.",