diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 589ba2bc..37b27a1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,3 +33,5 @@ jobs: run: pnpm test - name: Deploy 😎 run: pnpm generate + - name: Verify SEO output 🔎 + run: pnpm verify:seo diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index df4f2c92..17860f4f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -36,10 +36,20 @@ jobs: run: pnpm install --frozen-lockfile --ignore-scripts - name: Prepare Nuxt run: pnpm exec nuxt prepare + - name: Skew protection build history 🗄️ + # nuxt-skew-protection keeps previous build assets alive for clients + # with cached HTML; it needs its build history preserved across runs. + uses: actions/cache@v4 + with: + path: node_modules/.cache/nuxt-seo/skew-protection + key: skew-protection-${{ github.run_id }} + restore-keys: skew-protection- - name: Lint check ✅ run: pnpm lint - name: Deploy 😎 run: pnpm generate + - name: Verify SEO output 🔎 + run: pnpm verify:seo - name: Publish 🍻 uses: actions/upload-pages-artifact@v5 with: diff --git a/AGENTS.md b/AGENTS.md index 3175495d..dcbb3720 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -13,6 +13,7 @@ pnpm enforces `minimumReleaseAge`; a release newer than the window resolves to a ```sh pnpm dev # dev server pnpm generate # static site generation (what CI deploys) +pnpm verify:seo # assert generated SEO output in .output/public (run after generate) pnpm lint # ESLint check pnpm lint:fix # ESLint auto-fix pnpm typecheck # scoped tsc over app/src and app/lib @@ -20,7 +21,7 @@ pnpm test # all tests (both unit and nuxt projects) pnpm update-indexes # fetch live market rates → app/assets/indicadores.json ``` -CI order: `lint → typecheck → test → generate` (not `build`). +CI order: `lint → typecheck → test → generate → verify:seo` (not `build`). ## TypeScript setup @@ -61,14 +62,27 @@ Canvas-based components (Chart.js, etc.) gate rendering on `canvas.getContext('2 `pnpm typecheck` covers `app/src` and `app/lib` only; full-project `tsc --noEmit` still reports pre-existing errors in `test/nuxt/*`. +The `nuxt` project loads Nuxt with `ssr: false` (hardcoded in `@nuxt/test-utils`), which means: + +- `document.title` is unreliable (unhead does not resolve string `titleTemplate`s client-side there) and JSON-LD from `useSchemaOrg()` never reaches the head. Both are asserted by `pnpm verify:seo`, which checks the generated `.output/public` — always run it after `pnpm generate` (CI does, right after the generate step). +- unhead applies DOM side effects on a timer: mount pages via `mountPageAndSettleHead` from `test/nuxt/seo-head.ts` before asserting head contents. + ## Architecture - `app/src/` — pure TS financial logic (CDB, LCI/LCA, Poupança, taxes, IOF). No Nuxt dependency; unit-testable in node env. - `app/store/` — Pinia stores (investment state, loads `indicadores.json` at runtime). - `app/components/` — Vue components. -- `app/pages/` — Nuxt pages (SPA, SSR is disabled). +- `app/pages/` — Nuxt pages (prerendered: `ssr: true`, HTML rendered at build time, hydrated into an SPA feel client-side). +- `app/components/OgImage/` — og:image templates (`*.satori.vue`) rendered to PNG by nuxt-og-image at `pnpm generate` time. - `app/assets/indicadores.json` — live market rates (CDI, SELIC, Poupança). Auto-updated by CI workflow; do not hand-edit for persistent changes—use `pnpm update-indexes`. +## SEO (`@nuxtjs/seo`) + +`sitemap.xml`, `robots.txt`, og:image PNGs (under `/_og/s/`), JSON-LD graphs and `llms.txt` are all **generated at build time** by the bundled modules — never hand-edit or commit `public/sitemap.xml` / `public/robots.txt` (a static `robots.txt` gets renamed to `_robots.txt` and treated as config source). + +- Per-page og:image is wired via `routeRules` (`ogImage` key) in `nuxt.config.ts`, **not** `defineOgImage()` — the vitest nuxt environment loads Nuxt with `ssr: false`, where nuxt-og-image bails out and its composables don't exist (see Testing). +- Internal links use trailing slashes (`/sobre/`); the site convention is `trailingSlash: true` and the link checker fails the build report otherwise. + ## Nuxt 4 conventions `future.compatibilityVersion: 4` is set. This activates Nuxt 4 directory conventions (e.g., `app/` directory layout instead of root-level `pages/`/`components/`). @@ -87,4 +101,4 @@ PR titles must follow **Conventional Commits** (enforced by CI workflow `pr-titl ## Deployment -The site is a static SPA deployed to GitHub Pages via `pnpm generate`. There is no server-side rendering. +The site is prerendered static HTML deployed to GitHub Pages via `pnpm generate`. SSR runs at build time only; after hydration the app behaves as an SPA. Skew protection keeps previous build assets alive for clients with cached HTML — its build history lives in `node_modules/.cache/nuxt-seo/skew-protection`, preserved by the cache step in `publish.yml`. diff --git a/app/components/NavigationBar.vue b/app/components/NavigationBar.vue index 7db423e8..b2019ab8 100644 --- a/app/components/NavigationBar.vue +++ b/app/components/NavigationBar.vue @@ -14,7 +14,7 @@ /> +// Rendered at build time by nuxt-og-image (Satori renderer) — see README of +// nuxt-og-image for the template constraints: inline styles + simple flex +// utilities only, no browser APIs. +const props = defineProps<{ + title?: string + description?: string +}>() + + + diff --git a/app/layouts/default.vue b/app/layouts/default.vue index 858d1e73..5aca9149 100644 --- a/app/layouts/default.vue +++ b/app/layouts/default.vue @@ -15,8 +15,8 @@ class="w-12 h-12" > -

- Calculadora Renda Fixa +

+ Calculadora de Renda Fixa

diff --git a/app/pages/como-calcular-imposto-de-renda.vue b/app/pages/como-calcular-imposto-de-renda.vue index e744fb1f..a55e04bb 100644 --- a/app/pages/como-calcular-imposto-de-renda.vue +++ b/app/pages/como-calcular-imposto-de-renda.vue @@ -110,6 +110,23 @@ Nota: Embora isenta de IR, a poupança geralmente oferece rentabilidade menor que CDB ou LCI. A escolha depende do seu objetivo (liquidez, segurança ou rentabilidade).

+

Perguntas frequentes

+

Quais são as alíquotas do IR em aplicações de renda fixa?

+

+ O IR é cobrado de forma regressiva conforme o prazo de aplicação: 22,5% até 180 dias, 20% de 181 a 360 dias, 17,5% de 361 a 720 dias e 15% + acima de 720 dias. +

+

Quando incide IOF sobre os rendimentos?

+

+ Em resgates feitos em até 30 dias do aporte incide IOF regressivo sobre os rendimentos (96% no primeiro dia, chegando a 0% no dia 30). O IOF + reduz o ganho antes da aplicação do IR. +

+

Quais investimentos são isentos de IR para pessoa física?

+

+ LCI, LCA e Poupança são isentos de IR para pessoa física, conforme a legislação vigente. Verifique sempre as condições contratuais e + eventuais alterações legislativas. +

+

Observações importantes