How secorto/secorto_web works
1. What this repository is
- This is a static personal site for secorto.com built with Astro and deployed through Netlify.
- The site is content-heavy rather than app-heavy: the core value comes from markdown content, localized pages, and generated listings for blog, talks, work, projects, and community.
2. Primary architecture style
- The repo follows a content-to-static-site pipeline:
- markdown and frontmatter live in src/content
- domain and utility layers normalize that content
- Astro pages and layouts render it into static HTML
- small client-side scripts provide selective interactivity
- This keeps most rendering server/build-time only, with minimal browser JavaScript.
3. Content model and sectioning
- Content is organized by section and locale:
- blog, talk, community, projects, work
- each section has en and es variants
- The site relies on Astro content collections and frontmatter processing to extract metadata such as dates, tags, translations, and slugs.
- The src/domain layer defines the canonical shape of entries, tags, navigation, translations, and page detail behavior.
4. Routing and localization
- The public URL structure is locale-aware:
- localized pages under src/pages/[locale]/...
- section detail pages under src/pages/[locale]/[section]/[...id].astro
- localized tags and RSS endpoints as well
- There is also root-level handling in src/pages/index.astro and src/scripts/language-redirect.js to steer users to the appropriate language.
- src/i18n centralizes locale config, date formatting, root route mapping, and language picker behavior.
5. Content loading and static path generation
- src/utils/sectionLoader.ts, src/utils/staticPathsBuilder.ts, and related adapters assemble the route list for Astro’s static generation.
- These utilities are responsible for discovering content entries, pairing translations, and producing the paths used by section index pages, detail pages, and tag pages.
- This is a key boundary: content is not hardcoded in page components; it is transformed into route data first.
6. Rendering layer
- src/pages contains the route entry points, while src/layouts provides page scaffolding:
- BaseLayout.astro, SiteLayout.astro, MarkdownLayout.astro
- src/components contains reusable UI blocks like header, footer, sidebar, language picker, SEO head, post lists, tag chips, and special views for work/posts/talks.
- The rendering pattern is mostly “page assembles layout + components + content data,” with little business logic in the views.
7. Client-side enhancements
- src/client and src/scripts contain the browser-side behaviors:
- theme toggle
- sidebar interactions
- Giscus comments integration
- language redirect support
- These scripts are isolated from the static rendering path and act as progressive enhancement only.
- The project also includes a service worker at public/sw.js, which suggests offline/cache behavior is part of the published site.
8. External integrations
- The main external service visible in the architecture is Giscus for comments.
- Social/embedded media support exists through components like responsive iframes and mocked third-party embeds in tests.
- Netlify is a first-class deployment target, and the repo includes custom scripts to wait for preview deploys during CI.
9. Build and deployment concerns
- astro.config.mjs, netlify.toml, and the Netlify wait scripts show that build and preview deployment are tightly integrated.
- CI appears to validate both the static site and preview deployment availability before running end-to-end tests.
- The project targets Node 20+ behavior, which matters for tooling and the Netlify wait script runtime.
10. Testing architecture
- The repo has a layered test strategy:
- Vitest for unit tests on domain, i18n, utils, and client behavior
- E2E tests for functional flows and accessibility
- both a tests/ suite and a cypress/ suite are present, indicating a migration/history of E2E tooling
- Tests focus on content rendering, locale switching, tags, RSS, robots, theme persistence, and accessibility, which reflects the site’s architecture priorities.
11. Cross-cutting concerns
- SEO and discoverability are explicit via SEOHead, robots.txt, RSS generation, alternate links, and locale-aware routing.
- Accessibility is also treated as a first-class concern, with dedicated a11y tests and reusable UI components designed for navigation, sidebar, and responsive content.
12. How to think about the system diagram
- A useful architecture diagram would show:
- content sources in src/content
- flowing into domain/utility normalization
- then into Astro routes/layouts/components
- then into static output plus small client-side enhancements
- with Netlify/CI wrapping build, preview, and test execution
- The central architectural boundary is between build-time content generation and minimal runtime/browser interactivity.
Main entry points: pages Localized routes · sectionLoader.ts Section loader · Header.astro Site chrome · unit Unit tests
Components 22
Content pipeline
Markdown source, normalization, and route data generation.
- Content collections · Sectioned markdown content organized by locale and collection.
src/content - Content config · Defines Astro content collection rules and frontmatter validation.
src/content.config.ts - Domain model · Canonical types for posts, sections, tags, navigation, translations, and page detail behavior.
src/domain - Section loader · Loads section entries, pairs translations, and normalizes content for routes.
src/utils/sectionLoader.ts - Path builder · Builds static route lists and adapters for Astro prerendering.
src/utils/staticPathsBuilder.ts - RSS builder · Produces feed data and XML output for localized sections.
src/utils/rssBuilder.ts - I18n core · Locale definitions, root route mapping, date formatting, and UI language helpers.
src/i18n
Astro site
Pages, layouts, and reusable components that render the static site.
- Localized routes · Locale-aware entry points for home, sections, tags, RSS, robots, and detail pages.
src/pages - Layouts · Page scaffolding for base shell, site chrome, and markdown content.
src/layouts - Site chrome · Header, footer, sidebar, navigation, language picker, and theme UI.
src/components/Header.astro - Content views · Lists, post views, tags, dates, SEO head, embeds, and specialized section views.
src/components/PostList.astro
Browser runtime
Small client-side enhancements loaded after the static render.
- Theme toggle · Browser-side theme state and icon behavior.
src/client/themeToggle.ts - Sidebar script · Client interactions for sidebar and menu behavior.
src/client/sidebar.ts - Giscus bridge · Progressive enhancement for the comments integration.
src/client/giscus.ts - Lang redirect · Steers visitors to the appropriate locale root route.
src/scripts/language-redirect.js - Service worker · Static asset caching and offline behavior for the published site.
public/sw.js
Build and delivery
Configuration, deployment hooks, and test orchestration.
- Astro config · Top-level Astro build and integration settings.
astro.config.mjs - Netlify config · Deployment and preview build configuration for Netlify.
netlify.toml - Wait scripts · CI helpers that wait for preview deploy availability before tests run.
.github/scripts/wait-netlify.js
Testing
Unit, functional, and end-to-end verification layers.
- Unit tests · Fast verification of domain, i18n, utils, client code, and deployment helpers.
tests/unit - E2E tests · Functional, accessibility, smoke, and content-flow coverage.
tests/e2e - Cypress suite · Older browser test suite kept alongside the newer E2E coverage.
cypress
Connections 29
- Content collections → Content config: validated by · Markdown collections are defined and checked through the content schema.
- Content collections → Domain model: normalized into · Raw frontmatter and entry data are shaped into canonical domain types.
- Domain model → Section loader: feeds · Domain rules guide how entries and translations are assembled.
- Content collections → Section loader: loaded by · Section loaders discover localized entries and metadata.
- Section loader → Path builder: drives · Normalized section data becomes route sets for static generation.
- Section loader → RSS builder: feeds · Loaded content powers localized RSS output.
- Section loader → I18n core: localized with · Locale and language helpers shape route and display behavior.
- I18n core → Localized routes: routes · Locale mapping determines public URL structure and language selection.
- Path builder → Localized routes: prerenders · Static path builders supply Astro with section, detail, and tag paths.
- RSS builder → Localized routes: renders · RSS XML endpoints are exposed through page routes.
- Localized routes → Layouts: assembles · Route entry points compose the shared site layouts.
- Layouts → Site chrome: uses · Layouts bring in shell components for site-wide chrome.
- Layouts → Content views: uses · Layouts render lists, detail views, SEO, and content-specific UI.
- Site chrome → Theme toggle: enhanced by · Theme UI is activated and persisted in the browser.
- Site chrome → Sidebar script: enhanced by · Navigation and sidebar interactions are handled client-side.
- Content views → Giscus bridge: enhanced by · Comments are injected through a small client bridge.
- Localized routes → Lang redirect: redirected by · Root-level language steering is handled outside the page render path.
- Localized routes → Service worker: cached by · Published assets can be cached for offline-like behavior.
- Astro config → Localized routes: builds · Astro configuration governs route compilation and site build behavior.
- Netlify config → Astro config: deploys · Netlify is the primary deployment target for the Astro build.
- Wait scripts → Netlify config: verifies · CI waits for preview deploy availability before test execution.
- Unit tests → Domain model: covers · Unit tests validate domain rules and computed entry behavior.
- Unit tests → I18n core: covers · Locale helpers and formatting are tested directly.
- Unit tests → Section loader: covers · Content loading and route assembly are validated in isolation.
- Unit tests → Theme toggle: covers · Browser enhancement logic is unit tested.
- E2E tests → Localized routes: exercises · Functional browser tests cover localized pages, feeds, tags, and accessibility.
- E2E tests → Site chrome: exercises · E2E flows verify navigation, footer, and sidebar behavior.
- Cypress suite → Localized routes: exercises · Legacy Cypress coverage still targets key site flows.
- Cypress suite → Site chrome: exercises · Legacy browser tests focus on navigation and interactive chrome.