About this project

NK Omladinac Niza is the repository of the official website of the football club of the same name from Niza (Koška Municipality). The site is built with Astro, Tailwind CSS v4 and TypeScript, and is hosted on GitHub Pages. The live source of sports data is HNS Semafor. The main feature is automated content refreshing. Three scrapers and one manual source populate the data: 1. HNS Semafor (sports data) — the script scripts/scrape.mjs uses a Cheerio parser to extract the club name, stadium, address, crest, current competition and season, the entire league table with crests and form, all season matches from all competitions (league and cup), details of played matches (lineups, goals, cards, referees, spectators), players with photos, numbers, positions and appearance statistics, and ranking lists of scorers, cards and most appearances. All competitions in which the club participates are scraped, by age group (seniors and U-11 beginners), and the list of competitions comes through Semafor's getCompetitions handler. The result is src/data/hns.json with data per competition and a unified senior view. 2. Facebook news — scripts/scrape-facebook.mjs uses Graph API v21.0 to fetch the latest posts from the @omladinacniza page. Images are downloaded locally because FB CDN URLs expire in one to two weeks. GitHub Secrets FB_PAGE_ID and FB_ACCESS_TOKEN are required. 3. Facebook albums (gallery) — scripts/scrape-facebook-albums.mjs fetches all albums and photo metadata, with a quota per calendar year (FB_PHOTOS_PER_YEAR, default 200). For each photo a 500 px WebP thumbnail and dimensions are saved; the grid displays the thumbnail, and the lightbox displays the original. Profile and cover images are skipped. 4. Friendly matches — the only file that may be edited manually is src/data/friendlies.json, with instructions in friendlies.README.md; it can also be edited from a phone via GitHub. The scrapers write files only when the content has changed, so they do not create unnecessary commits and deploys. The GitHub Action workflow scrape-and-deploy.yml runs on a cron schedule every 30 minutes, on every push to main, and manually. It runs all three scrapers, commits the changes, then rebuilds and deploys; the build job deliberately does not scrape again so that the published site and the repo do not diverge. The project structure includes components (Header, Footer, cards, table), a layout with SEO/OG/favicon/manifest/RSS/View Transitions settings, libraries for base path, unified matches, Croatian number declension and Facebook post formatting, and pages: static .astro pages, player profiles, match details, dynamic OG images per match (satori and resvg), RSS feed, schedule in .ics format for subscription, and a PWA manifest. Styles use Tailwind v4 @theme with club colors and fonts. Local development requires Node.js 22.12+. The scripts include a dev server with hot reload, scrape:hns, scrape:facebook, scrape:fb-albums, scrape (all three), thumbs for WebP thumbnails, build (which automatically scrapes first), astro build without scraping, check for type checking, and preview of the production build. Deployment is to GitHub Pages through GitHub Actions, with the domain omladinacniza.hr configured via public/CNAME (deSEC DNS), while SITE and BASE are set in astro.config.mjs and can be overridden with the ASTRO_SITE and ASTRO_BASE variables. All club content (logo, photos, history) is the property of NK Omladinac Niza, and the code is freely available for inspiration to other clubs.