Compare commits
9
Commits
abeabb3a44
...
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d56769388 | ||
|
|
91b61caa37 | ||
|
|
b7bb664c95 | ||
|
|
809b60d85e | ||
|
|
448dd881e4 | ||
|
|
8021ea7254 | ||
|
|
e927396505 | ||
|
|
cb29c68d75 | ||
|
|
071bc1eaa5 |
No files matched your search
+2
-2
@@ -2,7 +2,6 @@
|
||||
|
||||
# --- Domains (Caddy) ---
|
||||
PUBLIC_DOMAIN=blog.localhost
|
||||
CMS_DOMAIN=cms.blog.localhost
|
||||
ACME_EMAIL=admin@example.com
|
||||
|
||||
# --- Database ---
|
||||
@@ -25,4 +24,5 @@ STRAPI_URL=http://cms:1337
|
||||
# Public base URL of the website, used for canonical URLs and Open Graph.
|
||||
PUBLIC_SITE_URL=https://blog.localhost
|
||||
# Public base URL of Strapi, used to build absolute media URLs in the browser.
|
||||
PUBLIC_STRAPI_URL=https://cms.blog.localhost
|
||||
# Same origin as PUBLIC_SITE_URL: Caddy proxies /admin and /uploads to Strapi.
|
||||
PUBLIC_STRAPI_URL=https://blog.localhost
|
||||
@@ -10,6 +10,9 @@ node_modules/
|
||||
*.pem
|
||||
*.key
|
||||
|
||||
# ops (holds VPS credentials, never commit)
|
||||
ops/
|
||||
|
||||
# nuxt
|
||||
frontend/.nuxt/
|
||||
frontend/.output/
|
||||
|
||||
@@ -16,24 +16,35 @@ sitemap e `robots.txt` dinamici, ricerca, e i test (nessun framework ancora conf
|
||||
## Architettura
|
||||
|
||||
```text
|
||||
Browser → Caddy ─┬─ dominio pubblico → Nuxt 4 (SSR) → REST Strapi
|
||||
└─ sottodominio CMS → Strapi 5 → PostgreSQL
|
||||
Browser → Caddy ─┬─ /admin e i path dei plugin Strapi → Strapi 5 → PostgreSQL
|
||||
└─ tutto il resto → Nuxt 4 (SSR) → REST Strapi
|
||||
```
|
||||
|
||||
Caddy instrada per **path**, non per sottodominio: `PUBLIC_DOMAIN` serve sia il sito che il
|
||||
pannello Strapi. Ogni plugin Strapi monta la propria API admin sul proprio path di primo
|
||||
livello, non tutto sotto `/admin` (es. `/content-manager`, `/upload`, `/i18n`...): l'elenco
|
||||
completo dei prefissi da instradare a Strapi vive nel `Caddyfile`. Se aggiungi un plugin
|
||||
Strapi, aggiungi il suo prefisso lì. Niente di questo tocca `/api`, riservato agli endpoint
|
||||
Nitro del frontend. Un solo dominio, un solo certificato TLS.
|
||||
|
||||
- Strapi è la **sola** fonte di verità editoriale. Niente altro backend (no Express/Nest/Fastify):
|
||||
se serve logica server, sta in Nitro (`frontend/server/`) o in un controller Strapi.
|
||||
- I visitatori pubblici non si autenticano mai. Solo editor/admin usano l'auth Strapi.
|
||||
- **Il browser non parla mai con Strapi.** Le pagine chiamano gli endpoint Nitro in
|
||||
`frontend/server/api/`, che sono l'unico posto dove si costruiscono query Strapi. Così
|
||||
`NUXT_STRAPI_URL` resta l'indirizzo interno Docker, niente CORS e niente token nel client.
|
||||
Se aggiungi una vista, aggiungi l'endpoint lì e tipizza il ritorno in `shared/types/blog.ts`.
|
||||
- **Il browser dei visitatori pubblici non parla mai con Strapi.** Le pagine chiamano gli
|
||||
endpoint Nitro in `frontend/server/api/`, che sono l'unico posto dove si costruiscono
|
||||
query Strapi. Così `NUXT_STRAPI_URL` resta l'indirizzo interno Docker, niente CORS e
|
||||
niente token nel client. Se aggiungi una vista, aggiungi l'endpoint lì e tipizza il
|
||||
ritorno in `shared/types/blog.ts`. Fanno eccezione, per costruzione: l'admin panel
|
||||
(`/admin`, uso editor/admin autenticato) e le immagini cover, che il browser carica
|
||||
direttamente da `PUBLIC_STRAPI_URL` (`/uploads/...`, sola lettura, nessun'autenticazione
|
||||
richiesta né concessa).
|
||||
- Il Markdown dell'articolo è convertito in HTML **nell'endpoint**, non nel componente: il
|
||||
contenuto è già nell'HTML SSR e `marked` resta fuori dal bundle client.
|
||||
- L'**interfaccia** è tradotta in en/it/es/fr con `@nuxtjs/i18n`: stringhe in
|
||||
`frontend/i18n/locales/*.json`, rotte `prefix_except_default` (inglese senza prefisso),
|
||||
`hreflang` e `og:locale` generati da `useLocaleHead()` in `app.vue`. Nessuna stringa
|
||||
visibile va scritta a mano in un componente: aggiungi la chiave nei quattro file.
|
||||
I **contenuti** invece restano monolingua — la localizzazione di Strapi è disattivata.
|
||||
- L'**interfaccia** è solo in italiano, stringhe statiche nei componenti (niente
|
||||
`@nuxtjs/i18n`, niente file di traduzione): `<html lang="it">` è fisso in
|
||||
`nuxt.config.ts`. La traduzione per i visitatori stranieri è delegata all'estensione
|
||||
Google Translate del browser, non è gestita dall'app. I **contenuti** restano
|
||||
monolingua — la localizzazione di Strapi è disattivata.
|
||||
- `cms/src/index.ts` (`bootstrap`) dà al ruolo Public solo `find`/`findOne` su Article e Category,
|
||||
e disattiva la registrazione pubblica: non esistono utenti front-end, solo amministratori.
|
||||
Qualsiasi permesso in più va motivato.
|
||||
|
||||
@@ -4,8 +4,8 @@ Blog platform: a public website built with Nuxt, and a private Strapi CMS where
|
||||
articles are written. Everything runs behind Caddy via Docker Compose.
|
||||
|
||||
```text
|
||||
Browser → Caddy ─┬─ public domain → Nuxt (website)
|
||||
└─ cms subdomain → Strapi (CMS) → PostgreSQL
|
||||
Browser → Caddy ─┬─ /admin and Strapi's plugin paths → Strapi (CMS) → PostgreSQL
|
||||
└─ everything else → Nuxt (website)
|
||||
```
|
||||
|
||||
There are no front-end accounts: sign-up is disabled and only administrators write
|
||||
@@ -46,7 +46,8 @@ The first build takes a few minutes. `docker-compose.dev.yml` publishes the port
|
||||
`127.0.0.1` and leaves Caddy out; it must always be passed explicitly, so it can never be
|
||||
picked up by accident in production.
|
||||
|
||||
**4. Create the administrator account** at http://localhost:1337/admin. This is the first
|
||||
**4. Create the administrator account** at http://localhost:1337/admin (dev bypasses Caddy,
|
||||
so the CMS is reached directly on its port). This is the first
|
||||
run, so the form creates the account — pick your own credentials.
|
||||
|
||||
**5. Write something.** In the admin panel: create a **Category**, then an **Article**
|
||||
@@ -72,16 +73,15 @@ override it with `NUXT_STRAPI_URL` if needed. Strapi reads its own `cms/.env`.
|
||||
|
||||
## Production
|
||||
|
||||
**1. Point the DNS at the server.** Two `A` records (and `AAAA` if you have IPv6) on the
|
||||
**1. Point the DNS at the server.** One `A` record (and `AAAA` if you have IPv6) on the
|
||||
public IP of the machine:
|
||||
|
||||
| Record | Purpose |
|
||||
|---|---|
|
||||
| `example.com` | the website |
|
||||
| `cms.example.com` | the Strapi admin panel |
|
||||
| `example.com` | the website and, at `/admin`, the Strapi admin panel |
|
||||
|
||||
Wait for the records to resolve before starting the stack — Caddy requests the
|
||||
certificates on the first boot and a failed challenge means a retry delay.
|
||||
Wait for the record to resolve before starting the stack — Caddy requests the
|
||||
certificate on the first boot and a failed challenge means a retry delay.
|
||||
|
||||
**2. Open the firewall** for ports `80` and `443` only. Port `80` is required: Caddy uses
|
||||
it for the ACME challenge and to redirect to HTTPS. PostgreSQL, Strapi and Nuxt are only
|
||||
@@ -92,10 +92,9 @@ reachable inside the Docker network — do not publish their ports.
|
||||
| Variable | Value |
|
||||
|---|---|
|
||||
| `PUBLIC_DOMAIN` | `example.com` |
|
||||
| `CMS_DOMAIN` | `cms.example.com` |
|
||||
| `ACME_EMAIL` | a mailbox you read — Let's Encrypt sends expiry warnings there |
|
||||
| `PUBLIC_SITE_URL` | `https://example.com` |
|
||||
| `PUBLIC_STRAPI_URL` | `https://cms.example.com` |
|
||||
| `PUBLIC_STRAPI_URL` | `https://example.com` — same origin, Caddy proxies `/admin` and Strapi's other plugin paths there (see `caddy/Caddyfile`) |
|
||||
| `STRAPI_URL` | leave it as `http://cms:1337` — internal address, never public |
|
||||
|
||||
Then generate **fresh** secrets on that machine with the same loop as in development —
|
||||
@@ -112,11 +111,11 @@ already ignored.
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
This time Caddy is included: it serves the website on `PUBLIC_DOMAIN`, the CMS on
|
||||
`CMS_DOMAIN`, obtains and renews the TLS certificates on its own, and adds HSTS and the
|
||||
other security headers.
|
||||
This time Caddy is included: it serves both the website and, under `/admin` and Strapi's
|
||||
other plugin paths, the CMS on `PUBLIC_DOMAIN`, obtains and renews the TLS certificate on
|
||||
its own, and adds HSTS and the other security headers.
|
||||
|
||||
**5. Create the administrator account** at `https://cms.example.com/admin`, immediately,
|
||||
**5. Create the administrator account** at `https://example.com/admin`, immediately,
|
||||
before anyone else finds the URL — the first visitor to that form is the one who gets the
|
||||
account. Then publish as in development.
|
||||
|
||||
|
||||
+22
-9
@@ -15,15 +15,28 @@
|
||||
{$PUBLIC_DOMAIN} {
|
||||
import security_headers
|
||||
encode zstd gzip
|
||||
reverse_proxy frontend:3000
|
||||
}
|
||||
|
||||
{$CMS_DOMAIN} {
|
||||
import security_headers
|
||||
encode zstd gzip
|
||||
# Uploaded media can be large; Strapi's own limit still applies.
|
||||
request_body {
|
||||
max_size 100MB
|
||||
# Strapi mounts each of its (and its plugins') admin APIs at its own
|
||||
# top-level path, not all under /admin - the admin panel's dashboard
|
||||
# widgets, media library, i18n, etc each call their own plugin prefix.
|
||||
# This list is every @strapi/* package in cms/package.json plus the
|
||||
# core-bundled plugins (content-manager, content-type-builder, upload,
|
||||
# i18n, email, content-releases, review-workflows). Adding a new Strapi
|
||||
# plugin later means adding its prefix here too.
|
||||
# None of this touches /api, reserved for the frontend's own Nitro
|
||||
# endpoints.
|
||||
@cms path /admin* /content-manager* /content-type-builder* /upload*\
|
||||
/i18n* /email* /content-releases* /review-workflows*\
|
||||
/users-permissions* /cloud*
|
||||
handle @cms {
|
||||
# Uploaded media can be large; Strapi's own limit still applies.
|
||||
request_body {
|
||||
max_size 100MB
|
||||
}
|
||||
reverse_proxy cms:1337
|
||||
}
|
||||
|
||||
handle {
|
||||
reverse_proxy frontend:3000
|
||||
}
|
||||
reverse_proxy cms:1337
|
||||
}
|
||||
@@ -9,8 +9,6 @@ services:
|
||||
cms:
|
||||
ports:
|
||||
- "127.0.0.1:1337:1337"
|
||||
environment:
|
||||
STRAPI_URL: http://localhost:1337
|
||||
|
||||
frontend:
|
||||
ports:
|
||||
@@ -18,4 +16,3 @@ services:
|
||||
environment:
|
||||
NUXT_PUBLIC_SITE_URL: http://localhost:3000
|
||||
NUXT_PUBLIC_STRAPI_URL: http://localhost:1337
|
||||
NUXT_PUBLIC_I18N_BASE_URL: http://localhost:3000
|
||||
+5
-4
@@ -36,7 +36,6 @@ services:
|
||||
TRANSFER_TOKEN_SALT: ${TRANSFER_TOKEN_SALT}
|
||||
JWT_SECRET: ${JWT_SECRET}
|
||||
ENCRYPTION_KEY: ${ENCRYPTION_KEY}
|
||||
STRAPI_URL: https://${CMS_DOMAIN}
|
||||
volumes:
|
||||
- cms-uploads:/app/public/uploads
|
||||
|
||||
@@ -52,8 +51,6 @@ services:
|
||||
NUXT_STRAPI_URL: ${STRAPI_URL}
|
||||
NUXT_PUBLIC_SITE_URL: ${PUBLIC_SITE_URL}
|
||||
NUXT_PUBLIC_STRAPI_URL: ${PUBLIC_STRAPI_URL}
|
||||
# Absolute origin for the alternate-language links.
|
||||
NUXT_PUBLIC_I18N_BASE_URL: ${PUBLIC_SITE_URL}
|
||||
|
||||
caddy:
|
||||
image: caddy:2-alpine
|
||||
@@ -64,9 +61,13 @@ services:
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
# Host uses systemd-resolved (127.0.0.53), unreachable from inside the
|
||||
# container network namespace; ACME lookups need a real resolver.
|
||||
dns:
|
||||
- 1.1.1.1
|
||||
- 8.8.8.8
|
||||
environment:
|
||||
PUBLIC_DOMAIN: ${PUBLIC_DOMAIN}
|
||||
CMS_DOMAIN: ${CMS_DOMAIN}
|
||||
ACME_EMAIL: ${ACME_EMAIL}
|
||||
volumes:
|
||||
- ./caddy/Caddyfile:/etc/caddy/Caddyfile:ro
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
<script setup lang="ts">
|
||||
// Emits <html lang>, the alternate-language links and og:locale for every page.
|
||||
useHead(useLocaleHead())
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<NuxtRouteAnnouncer />
|
||||
|
||||
@@ -13,8 +13,18 @@
|
||||
|
||||
--width: 76rem;
|
||||
--width-prose: 40rem;
|
||||
--space: 1.5rem;
|
||||
--radius: 2px;
|
||||
|
||||
/* Breakpoints used throughout: 48rem = tablet, 64rem = desktop. */
|
||||
--space: 1.1rem;
|
||||
--gap-section: 2.5rem;
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
:root {
|
||||
--space: 1.5rem;
|
||||
--gap-section: 4rem;
|
||||
}
|
||||
}
|
||||
|
||||
*,
|
||||
@@ -99,7 +109,7 @@ h3 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1.25rem;
|
||||
margin-block: 4rem 2rem;
|
||||
margin-block: var(--gap-section) 1.75rem;
|
||||
}
|
||||
|
||||
.section-heading::after {
|
||||
@@ -111,8 +121,8 @@ h3 {
|
||||
|
||||
/* Centred title block at the top of a listing page. */
|
||||
.page-header {
|
||||
margin-bottom: 3.5rem;
|
||||
padding-bottom: 2rem;
|
||||
margin-bottom: var(--gap-section);
|
||||
padding-bottom: 1.75rem;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
}
|
||||
@@ -127,17 +137,40 @@ h3 {
|
||||
|
||||
.card-grid {
|
||||
display: grid;
|
||||
gap: 3rem 2.5rem;
|
||||
grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
|
||||
gap: 2.25rem 1.5rem;
|
||||
/* One column on phones, two on tablets, three or more on wide screens. */
|
||||
grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
.card-grid {
|
||||
gap: 3rem 2.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Article body */
|
||||
.prose {
|
||||
max-width: var(--width-prose);
|
||||
font-size: 1.075rem;
|
||||
font-size: 1.0125rem;
|
||||
/* Editors paste long URLs; without this they push the page sideways. */
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
.prose {
|
||||
font-size: 1.075rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Markdown tables have no wrapper to scroll, so the table scrolls itself. */
|
||||
.prose table {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
overflow-x: auto;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.prose h2,
|
||||
@@ -193,10 +226,10 @@ h3 {
|
||||
.pagination {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 2rem;
|
||||
gap: 1rem 2rem;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 4rem;
|
||||
margin-top: var(--gap-section);
|
||||
padding-top: 2rem;
|
||||
border-top: 1px solid var(--color-border);
|
||||
font-size: 0.85rem;
|
||||
|
||||
@@ -3,21 +3,22 @@ import type { ArticleSummary } from '#shared/types/blog'
|
||||
|
||||
const props = defineProps<{ article: ArticleSummary }>()
|
||||
|
||||
const { locale } = useI18n()
|
||||
const mediaUrl = useMediaUrl()
|
||||
const cover = computed(() => mediaUrl(props.article.cover))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<article class="card">
|
||||
<NuxtLinkLocale
|
||||
<!-- No placeholder box when there is no cover: an empty grey rectangle
|
||||
reads as a broken image rather than as a deliberate choice. -->
|
||||
<NuxtLink
|
||||
v-if="cover"
|
||||
class="cover-link"
|
||||
:to="`/blog/${article.slug}`"
|
||||
tabindex="-1"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<img
|
||||
v-if="cover"
|
||||
class="cover"
|
||||
:src="cover"
|
||||
:alt="article.cover?.alternativeText ?? ''"
|
||||
@@ -25,18 +26,17 @@ const cover = computed(() => mediaUrl(props.article.cover))
|
||||
:height="article.cover?.height ?? undefined"
|
||||
loading="lazy"
|
||||
>
|
||||
<span v-else class="cover placeholder" />
|
||||
</NuxtLinkLocale>
|
||||
</NuxtLink>
|
||||
|
||||
<p v-if="article.category" class="kicker">{{ article.category.name }}</p>
|
||||
|
||||
<h2>
|
||||
<NuxtLinkLocale :to="`/blog/${article.slug}`">{{ article.title }}</NuxtLinkLocale>
|
||||
<NuxtLink :to="`/blog/${article.slug}`">{{ article.title }}</NuxtLink>
|
||||
</h2>
|
||||
|
||||
<p class="kicker date">
|
||||
<time :datetime="isoDate(article.publishedAt)">
|
||||
{{ formatDate(article.publishedAt, locale) }}
|
||||
{{ formatDate(article.publishedAt) }}
|
||||
</time>
|
||||
</p>
|
||||
</article>
|
||||
@@ -60,11 +60,9 @@ const cover = computed(() => mediaUrl(props.article.cover))
|
||||
transform: scale(1.03);
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.kicker {
|
||||
/* Without a cover the kicker leads the card, so it needs no offset. */
|
||||
.cover-link + .kicker,
|
||||
.cover-link + h2 {
|
||||
margin-top: 1.1rem;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
const { locale, locales, t } = useI18n()
|
||||
const switchLocalePath = useSwitchLocalePath()
|
||||
const router = useRouter()
|
||||
|
||||
/**
|
||||
* A native select: it gets keyboard support, the platform picker on mobile and
|
||||
* correct labelling for free, which a hand-built dropdown would have to rebuild.
|
||||
*/
|
||||
function onChange(event: Event) {
|
||||
const code = (event.target as HTMLSelectElement).value as typeof locale.value
|
||||
const path = switchLocalePath(code)
|
||||
if (path) router.push(path)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="switcher">
|
||||
<label class="visually-hidden" for="locale-select">{{ t('site.languageLabel') }}</label>
|
||||
<select id="locale-select" :value="locale" @change="onChange">
|
||||
<option v-for="option in locales" :key="option.code" :value="option.code">
|
||||
{{ option.name }}
|
||||
</option>
|
||||
</select>
|
||||
<span class="arrow" aria-hidden="true">▾</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.switcher {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
select {
|
||||
appearance: none;
|
||||
padding: 0.35rem 1.6rem 0.35rem 0.7rem;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
color: var(--color-body);
|
||||
font: inherit;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
select:hover {
|
||||
border-color: var(--color-ink);
|
||||
color: var(--color-ink);
|
||||
}
|
||||
|
||||
.arrow {
|
||||
position: absolute;
|
||||
right: 0.6rem;
|
||||
font-size: 0.65rem;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.visually-hidden {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip-path: inset(50%);
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
@@ -5,20 +5,21 @@ const props = defineProps<{ error: NuxtError }>()
|
||||
|
||||
const isNotFound = computed(() => props.error.statusCode === 404)
|
||||
|
||||
useHead(useLocaleHead())
|
||||
useSeoMeta({ robots: 'noindex' })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<NuxtLayout>
|
||||
<h1>{{ isNotFound ? $t('error.notFoundTitle') : $t('error.genericTitle') }}</h1>
|
||||
<h1>{{ isNotFound ? 'Pagina non trovata' : 'Qualcosa è andato storto' }}</h1>
|
||||
|
||||
<p class="muted">
|
||||
{{ isNotFound ? $t('error.notFoundBody') : $t('error.genericBody') }}
|
||||
{{ isNotFound
|
||||
? 'La pagina che cerchi non esiste o è stata spostata.'
|
||||
: 'Riprova tra qualche istante.' }}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<NuxtLinkLocale to="/">{{ $t('error.backHome') }}</NuxtLinkLocale>
|
||||
<NuxtLink to="/">Torna alla home</NuxtLink>
|
||||
</p>
|
||||
</NuxtLayout>
|
||||
</template>
|
||||
@@ -1,39 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
import type { Category } from '#shared/types/blog'
|
||||
|
||||
const { locale } = useI18n()
|
||||
|
||||
const { data: categories } = await useFetch<Category[]>('/api/categories', {
|
||||
key: 'nav-categories',
|
||||
default: () => [],
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page">
|
||||
<a class="skip-link" href="#main">{{ $t('site.skipToContent') }}</a>
|
||||
<a class="skip-link" href="#main">Vai al contenuto</a>
|
||||
|
||||
<header class="site-header">
|
||||
<div class="container">
|
||||
<p class="wordmark">
|
||||
<NuxtLinkLocale to="/">
|
||||
<NuxtLink to="/">
|
||||
<img src="/logo.png" :alt="SITE_NAME" width="400" height="400">
|
||||
</NuxtLinkLocale>
|
||||
</NuxtLink>
|
||||
</p>
|
||||
<p class="tagline kicker">{{ $t('site.tagline') }}</p>
|
||||
<p class="tagline kicker">Articoli, guide e analisi.</p>
|
||||
</div>
|
||||
|
||||
<nav class="site-nav" :aria-label="$t('site.mainNavigation')">
|
||||
<nav class="site-nav" aria-label="Navigazione principale">
|
||||
<div class="container nav-inner">
|
||||
<ul>
|
||||
<li><NuxtLinkLocale to="/blog">{{ $t('site.allArticles') }}</NuxtLinkLocale></li>
|
||||
<li v-for="category in categories" :key="category.slug">
|
||||
<NuxtLinkLocale :to="`/category/${category.slug}`">
|
||||
{{ category.name }}
|
||||
</NuxtLinkLocale>
|
||||
</li>
|
||||
<li><NuxtLink to="/">Home</NuxtLink></li>
|
||||
<li><NuxtLink to="/blog">Tutti gli articoli</NuxtLink></li>
|
||||
<li><NuxtLink to="/come-difendersi-dal-corralito">Come difendersi dal corralito</NuxtLink></li>
|
||||
</ul>
|
||||
<LanguageSwitcher />
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
@@ -46,35 +34,24 @@ const { data: categories } = await useFetch<Category[]>('/api/categories', {
|
||||
<div class="container footer-inner">
|
||||
<div class="footer-block">
|
||||
<img class="footer-logo" src="/logo.png" :alt="SITE_NAME" width="400" height="400">
|
||||
<p class="muted">{{ $t('site.tagline') }}</p>
|
||||
<p class="muted">Articoli, guide e analisi.</p>
|
||||
<address class="contact">
|
||||
{{ $t('site.contact') }}:
|
||||
Contatti:
|
||||
<a :href="`mailto:${SITE_EMAIL}`">{{ SITE_EMAIL }}</a>
|
||||
</address>
|
||||
</div>
|
||||
|
||||
<nav class="footer-block" :aria-label="$t('site.categories')">
|
||||
<p class="kicker">{{ $t('site.categories') }}</p>
|
||||
<nav class="footer-block" aria-label="Naviga">
|
||||
<p class="kicker">Naviga</p>
|
||||
<ul>
|
||||
<li v-for="category in categories" :key="category.slug">
|
||||
<NuxtLinkLocale :to="`/category/${category.slug}`">
|
||||
{{ category.name }}
|
||||
</NuxtLinkLocale>
|
||||
</li>
|
||||
<li v-if="!categories.length" class="muted">{{ $t('site.noCategories') }}</li>
|
||||
<li><NuxtLink to="/">Home</NuxtLink></li>
|
||||
<li><NuxtLink to="/blog">Tutti gli articoli</NuxtLink></li>
|
||||
<li><NuxtLink to="/come-difendersi-dal-corralito">Come difendersi dal corralito</NuxtLink></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<nav class="footer-block" :aria-label="$t('site.browse')">
|
||||
<p class="kicker">{{ $t('site.browse') }}</p>
|
||||
<ul>
|
||||
<li><NuxtLinkLocale to="/">{{ $t('site.home') }}</NuxtLinkLocale></li>
|
||||
<li><NuxtLinkLocale to="/blog">{{ $t('site.allArticles') }}</NuxtLinkLocale></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<nav class="footer-block" :aria-label="$t('site.follow')">
|
||||
<p class="kicker">{{ $t('site.follow') }}</p>
|
||||
<nav class="footer-block" aria-label="Seguici">
|
||||
<p class="kicker">Seguici</p>
|
||||
<ul>
|
||||
<li v-for="social in SOCIAL_LINKS" :key="social.name">
|
||||
<a class="social" :href="social.url" target="_blank" rel="noopener me">
|
||||
@@ -86,8 +63,8 @@ const { data: categories } = await useFetch<Category[]>('/api/categories', {
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<p class="container copyright kicker" :lang="locale">
|
||||
© {{ new Date().getFullYear() }} {{ SITE_NAME }}. {{ $t('site.rights') }}
|
||||
<p class="container copyright kicker">
|
||||
© {{ new Date().getFullYear() }} {{ SITE_NAME }}. Tutti i diritti riservati.
|
||||
</p>
|
||||
</footer>
|
||||
</div>
|
||||
@@ -102,11 +79,17 @@ const { data: categories } = await useFetch<Category[]>('/api/categories', {
|
||||
|
||||
/* Header: centred wordmark over a thin rule of links. */
|
||||
.site-header {
|
||||
padding-top: 2.5rem;
|
||||
padding-top: 1.5rem;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
.site-header {
|
||||
padding-top: 2.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.wordmark {
|
||||
margin: 0;
|
||||
}
|
||||
@@ -127,23 +110,20 @@ const { data: categories } = await useFetch<Category[]>('/api/categories', {
|
||||
}
|
||||
|
||||
.site-nav {
|
||||
margin-top: 2rem;
|
||||
margin-top: 1.25rem;
|
||||
border-top: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.nav-inner {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.75rem 2rem;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-block: 0.9rem;
|
||||
justify-content: center;
|
||||
padding-block: 0.6rem;
|
||||
}
|
||||
|
||||
.site-nav ul {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.25rem 2rem;
|
||||
gap: 0 1.25rem;
|
||||
justify-content: center;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
@@ -154,10 +134,26 @@ const { data: categories } = await useFetch<Category[]>('/api/categories', {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
.site-nav {
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.nav-inner {
|
||||
padding-block: 0.9rem;
|
||||
}
|
||||
|
||||
.site-nav ul {
|
||||
gap: 0.25rem 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.site-nav a {
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
color: var(--color-body);
|
||||
padding-block: 0.25rem;
|
||||
/* Roomy enough to tap accurately on a phone. */
|
||||
padding-block: 0.6rem;
|
||||
border-bottom: 1px solid transparent;
|
||||
}
|
||||
|
||||
@@ -169,7 +165,13 @@ const { data: categories } = await useFetch<Category[]>('/api/categories', {
|
||||
|
||||
.site-main {
|
||||
flex: 1;
|
||||
padding-block: 3.5rem 5rem;
|
||||
padding-block: 2.25rem 3.5rem;
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
.site-main {
|
||||
padding-block: 3.5rem 5rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Footer: columns, then a centred copyright line. */
|
||||
@@ -179,13 +181,28 @@ const { data: categories } = await useFetch<Category[]>('/api/categories', {
|
||||
border-top: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
/* One column on phones, two on tablets, four on desktop — auto-fit would
|
||||
otherwise leave the fourth block stranded on its own row on a tablet. */
|
||||
.footer-inner {
|
||||
display: grid;
|
||||
gap: 2.5rem;
|
||||
grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
|
||||
gap: 2rem;
|
||||
grid-template-columns: 1fr;
|
||||
padding-bottom: 2.5rem;
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
.footer-inner {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 2.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 64rem) {
|
||||
.footer-inner {
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
.footer-block p:last-of-type {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { Article } from '#shared/types/blog'
|
||||
|
||||
const { locale } = useI18n()
|
||||
const route = useRoute()
|
||||
const slug = route.params.slug as string
|
||||
|
||||
@@ -53,13 +52,13 @@ useHead({
|
||||
<template>
|
||||
<article v-if="article">
|
||||
<header class="article-header">
|
||||
<nav class="kicker" :aria-label="$t('article.breadcrumb')">
|
||||
<NuxtLinkLocale to="/blog">{{ $t('list.articles') }}</NuxtLinkLocale>
|
||||
<nav class="kicker" aria-label="Percorso di navigazione">
|
||||
<NuxtLink to="/blog">Articoli</NuxtLink>
|
||||
<template v-if="article.category">
|
||||
<span aria-hidden="true"> / </span>
|
||||
<NuxtLinkLocale :to="`/category/${article.category.slug}`">
|
||||
<NuxtLink :to="`/category/${article.category.slug}`">
|
||||
{{ article.category.name }}
|
||||
</NuxtLinkLocale>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
</nav>
|
||||
|
||||
@@ -67,11 +66,11 @@ useHead({
|
||||
|
||||
<p class="kicker date">
|
||||
<time :datetime="isoDate(article.publishedAt)">
|
||||
{{ formatDateTime(article.publishedAt, locale) }}
|
||||
{{ formatDateTime(article.publishedAt) }}
|
||||
</time>
|
||||
<template v-if="article.author">
|
||||
<span aria-hidden="true"> · </span>
|
||||
<span>{{ $t('article.by', { name: article.author }) }}</span>
|
||||
<span>Di {{ article.author }}</span>
|
||||
</template>
|
||||
</p>
|
||||
</header>
|
||||
@@ -89,7 +88,7 @@ useHead({
|
||||
<div class="prose" v-html="article.html" />
|
||||
|
||||
<p class="back">
|
||||
<NuxtLinkLocale to="/blog">{{ $t('article.back') }}</NuxtLinkLocale>
|
||||
<NuxtLink to="/blog">Torna a tutti gli articoli</NuxtLink>
|
||||
</p>
|
||||
</article>
|
||||
</template>
|
||||
@@ -99,10 +98,16 @@ useHead({
|
||||
max-width: 46rem;
|
||||
/* The gap below the header lives here, not on the cover: an article without
|
||||
a cover image would otherwise have its body butting against the byline. */
|
||||
margin: 0 auto 3rem;
|
||||
margin: 0 auto 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
.article-header {
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
}
|
||||
|
||||
.article-header nav a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { ArticleSummary, Paginated } from '#shared/types/blog'
|
||||
|
||||
const { t } = useI18n()
|
||||
const route = useRoute()
|
||||
|
||||
const page = computed(() => {
|
||||
@@ -19,8 +18,8 @@ const canonical = computed(
|
||||
)
|
||||
|
||||
useSeoMeta({
|
||||
title: () => (page.value > 1 ? t('list.articlesPage', { page: page.value }) : t('list.articles')),
|
||||
description: () => t('list.archiveDescription'),
|
||||
title: () => (page.value > 1 ? `Articoli — pagina ${page.value}` : 'Articoli'),
|
||||
description: 'Tutti gli articoli pubblicati sul blog.',
|
||||
ogType: 'website',
|
||||
})
|
||||
|
||||
@@ -30,15 +29,15 @@ useHead({ link: [{ rel: 'canonical', href: canonical }] })
|
||||
<template>
|
||||
<div>
|
||||
<header class="page-header">
|
||||
<p class="kicker">{{ $t('list.archive') }}</p>
|
||||
<h1>{{ $t('list.articles') }}</h1>
|
||||
<p class="kicker">L'archivio</p>
|
||||
<h1>Articoli</h1>
|
||||
</header>
|
||||
|
||||
<p v-if="error">{{ $t('list.failed') }}</p>
|
||||
<p v-if="error">Non è stato possibile caricare gli articoli. Riprova più tardi.</p>
|
||||
|
||||
<p v-else-if="status === 'pending'">{{ $t('list.loading') }}</p>
|
||||
<p v-else-if="status === 'pending'">Caricamento…</p>
|
||||
|
||||
<p v-else-if="!data?.items.length">{{ $t('list.empty') }}</p>
|
||||
<p v-else-if="!data?.items.length">Non è stato ancora pubblicato nulla.</p>
|
||||
|
||||
<template v-else>
|
||||
<ul class="card-grid">
|
||||
@@ -47,19 +46,19 @@ useHead({ link: [{ rel: 'canonical', href: canonical }] })
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<nav v-if="data.pageCount > 1" class="pagination" :aria-label="$t('pagination.label')">
|
||||
<nav v-if="data.pageCount > 1" class="pagination" aria-label="Paginazione">
|
||||
<NuxtLink v-if="data.page > 1" :to="{ query: { page: data.page - 1 } }" rel="prev">
|
||||
{{ $t('pagination.previous') }}
|
||||
Pagina precedente
|
||||
</NuxtLink>
|
||||
<span class="muted">
|
||||
{{ $t('pagination.position', { page: data.page, total: data.pageCount }) }}
|
||||
Pagina {{ data.page }} di {{ data.pageCount }}
|
||||
</span>
|
||||
<NuxtLink
|
||||
v-if="data.page < data.pageCount"
|
||||
:to="{ query: { page: data.page + 1 } }"
|
||||
rel="next"
|
||||
>
|
||||
{{ $t('pagination.next') }}
|
||||
Pagina successiva
|
||||
</NuxtLink>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { ArticleSummary, Paginated, Category } from '#shared/types/blog'
|
||||
|
||||
const { t } = useI18n()
|
||||
const route = useRoute()
|
||||
const slug = route.params.slug as string
|
||||
|
||||
@@ -27,7 +26,7 @@ const canonical = computed(
|
||||
|
||||
useSeoMeta({
|
||||
title: category.value.name,
|
||||
description: () => t('list.categoryDescription', { name: category.value?.name ?? '' }),
|
||||
description: () => `Tutti gli articoli nella categoria ${category.value?.name ?? ''}.`,
|
||||
ogType: 'website',
|
||||
})
|
||||
|
||||
@@ -37,13 +36,13 @@ useHead({ link: [{ rel: 'canonical', href: canonical }] })
|
||||
<template>
|
||||
<div>
|
||||
<header class="page-header">
|
||||
<p class="kicker">{{ $t('list.category') }}</p>
|
||||
<p class="kicker">Categoria</p>
|
||||
<h1>{{ category?.name }}</h1>
|
||||
</header>
|
||||
|
||||
<p v-if="error">{{ $t('list.failed') }}</p>
|
||||
<p v-if="error">Non è stato possibile caricare gli articoli. Riprova più tardi.</p>
|
||||
|
||||
<p v-else-if="!data?.items.length">{{ $t('list.categoryEmpty') }}</p>
|
||||
<p v-else-if="!data?.items.length">Non ci sono articoli in questa categoria.</p>
|
||||
|
||||
<template v-else>
|
||||
<ul class="card-grid">
|
||||
@@ -52,19 +51,19 @@ useHead({ link: [{ rel: 'canonical', href: canonical }] })
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<nav v-if="data.pageCount > 1" class="pagination" :aria-label="$t('pagination.label')">
|
||||
<nav v-if="data.pageCount > 1" class="pagination" aria-label="Paginazione">
|
||||
<NuxtLink v-if="data.page > 1" :to="{ query: { page: data.page - 1 } }" rel="prev">
|
||||
{{ $t('pagination.previous') }}
|
||||
Pagina precedente
|
||||
</NuxtLink>
|
||||
<span class="muted">
|
||||
{{ $t('pagination.position', { page: data.page, total: data.pageCount }) }}
|
||||
Pagina {{ data.page }} di {{ data.pageCount }}
|
||||
</span>
|
||||
<NuxtLink
|
||||
v-if="data.page < data.pageCount"
|
||||
:to="{ query: { page: data.page + 1 } }"
|
||||
rel="next"
|
||||
>
|
||||
{{ $t('pagination.next') }}
|
||||
Pagina successiva
|
||||
</NuxtLink>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
<script setup lang="ts">
|
||||
const { public: config } = useRuntimeConfig()
|
||||
const route = useRoute()
|
||||
const canonical = computed(() => `${config.siteUrl}${route.path}`)
|
||||
|
||||
const title = 'Corsi di formazione sulle criptovalute'
|
||||
const description = 'Corsi pratici, individuali o di gruppo, per capire come funzionano le criptovalute e difendersi dal corralito.'
|
||||
|
||||
useSeoMeta({
|
||||
title,
|
||||
description,
|
||||
ogTitle: title,
|
||||
ogDescription: description,
|
||||
ogType: 'website',
|
||||
ogUrl: canonical,
|
||||
ogImage: `${config.siteUrl}/protesta-bancaria.jpg`,
|
||||
})
|
||||
|
||||
useHead({ link: [{ rel: 'canonical', href: canonical }] })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<article>
|
||||
<header class="article-header">
|
||||
<h1>Come difendersi dal corralito</h1>
|
||||
</header>
|
||||
|
||||
<img
|
||||
class="cover"
|
||||
src="/protesta-bancaria.jpg"
|
||||
alt="Manifesti e scritte contro le banche durante una crisi bancaria"
|
||||
width="770"
|
||||
height="420"
|
||||
>
|
||||
|
||||
<div class="prose">
|
||||
<p>
|
||||
Stai pensando di avvicinarti al mondo delle criptovalute (un mercato parallelo al
|
||||
mercato tradizionale finanziario), ma non sai da dove cominciare?
|
||||
</p>
|
||||
|
||||
<p>
|
||||
È possibile organizzare corsi individuali o di gruppo dedicati alla conoscenza e al
|
||||
funzionamento delle criptovalute, con un approccio prevalentemente pratico e senza
|
||||
fornire consigli o raccomandazioni finanziarie.
|
||||
</p>
|
||||
|
||||
<p>Durante il corso possiamo affrontare, tra gli altri, questi argomenti:</p>
|
||||
|
||||
<ul>
|
||||
<li>quali sono i principali tipi di criptovalute e quali differenze esistono tra loro;</li>
|
||||
<li>come funziona una blockchain e cosa significa realmente effettuare una transazione;</li>
|
||||
<li>dove e come vengono conservate le criptovalute: wallet, exchange e sistemi di custodia;</li>
|
||||
<li>come acquistare e vendere criptovalute e quali sono le principali modalità disponibili;</li>
|
||||
<li>come utilizzare un wallet e gestire correttamente le proprie chiavi;</li>
|
||||
<li>quali sono i principali rischi legati alla sicurezza e alla custodia;</li>
|
||||
<li>come orientarsi nel vastissimo universo delle criptovalute e dei token.</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Non si tratta di consulenza finanziaria e non verranno fornite indicazioni su quali
|
||||
criptovalute acquistare o vendere. L'obiettivo è fornire conoscenze e strumenti per
|
||||
comprendere questo nuovo mondo e muoversi al suo interno con maggiore consapevolezza.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="contact-cta">
|
||||
<p class="kicker">Per informazioni sui corsi, modalità e disponibilità</p>
|
||||
<p class="contact-links">
|
||||
<a :href="`mailto:${SITE_EMAIL}`">Scrivimi via email</a>
|
||||
<span aria-hidden="true">·</span>
|
||||
<a href="https://t.me/Ito1505" target="_blank" rel="noopener">Scrivimi su Telegram</a>
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.article-header {
|
||||
max-width: 46rem;
|
||||
margin: 0 auto 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
.article-header {
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
}
|
||||
|
||||
.cover {
|
||||
width: 100%;
|
||||
aspect-ratio: 16 / 9;
|
||||
object-fit: cover;
|
||||
margin-block: 0 3rem;
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.prose {
|
||||
margin-inline: auto;
|
||||
}
|
||||
|
||||
.contact-cta {
|
||||
max-width: var(--width-prose);
|
||||
margin: 3rem auto 0;
|
||||
padding-top: 2rem;
|
||||
border-top: 1px solid var(--color-border);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.contact-links {
|
||||
margin-top: 0.75rem;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 0.6rem;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.contact-links a {
|
||||
padding-bottom: 0.35rem;
|
||||
text-decoration: none;
|
||||
border-bottom: 1px solid var(--color-ink);
|
||||
}
|
||||
|
||||
.contact-links a:hover {
|
||||
color: var(--color-ink);
|
||||
}
|
||||
</style>
|
||||
@@ -1,16 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import type { ArticleSummary, Paginated } from '#shared/types/blog'
|
||||
|
||||
const { t, locale } = useI18n()
|
||||
|
||||
const { data, error } = await useFetch<Paginated<ArticleSummary>>('/api/articles', {
|
||||
key: 'home-articles',
|
||||
query: { page: 1 },
|
||||
})
|
||||
|
||||
/** The newest article leads the page; the next six fill the grid below it. */
|
||||
const featured = computed(() => data.value?.items[0] ?? null)
|
||||
const rest = computed(() => data.value?.items.slice(1, 7) ?? [])
|
||||
|
||||
const mediaUrl = useMediaUrl()
|
||||
const featuredCover = computed(() => mediaUrl(featured.value?.cover))
|
||||
@@ -24,9 +20,9 @@ useHead({ titleTemplate: '%s', link: [{ rel: 'canonical', href: canonical }] })
|
||||
|
||||
useSeoMeta({
|
||||
title: SITE_NAME,
|
||||
description: () => t('site.tagline'),
|
||||
description: 'Articoli, guide e analisi.',
|
||||
ogTitle: SITE_NAME,
|
||||
ogDescription: () => t('site.tagline'),
|
||||
ogDescription: 'Articoli, guide e analisi.',
|
||||
ogType: 'website',
|
||||
ogUrl: canonical,
|
||||
ogImage: `${config.siteUrl}/logo.png`,
|
||||
@@ -35,103 +31,162 @@ useSeoMeta({
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<p v-if="error">{{ $t('list.failed') }}</p>
|
||||
<section class="landing">
|
||||
<img
|
||||
class="landing-image"
|
||||
src="/protesta-bancaria.jpg"
|
||||
alt="Manifesti e scritte contro le banche durante una crisi bancaria"
|
||||
width="770"
|
||||
height="420"
|
||||
>
|
||||
|
||||
<p v-else-if="!featured">{{ $t('list.empty') }}</p>
|
||||
<h1>La fine dell'Unione Europea per come l'abbiamo conosciuta.</h1>
|
||||
|
||||
<img
|
||||
class="landing-image"
|
||||
src="/eurozona-crisi.jpg"
|
||||
alt="Bandiera dell'Unione Europea incrinata"
|
||||
width="1000"
|
||||
height="736"
|
||||
>
|
||||
|
||||
<div class="landing-text">
|
||||
<p>
|
||||
La fine della nostra moneta come moneta forte: la fine di quella moneta che ci ha
|
||||
dato la vera libertà di viaggiare, consumare e fare.
|
||||
</p>
|
||||
<p>
|
||||
Una fine che avverrà a seguito di un "incidente" nucleare, al quale farà seguito un
|
||||
corralito bancario, ossia l'impossibilità, da parte dei cittadini europei, di
|
||||
disporre liberamente dei propri depositi.
|
||||
</p>
|
||||
<p>
|
||||
Le monete fiduciarie sono per loro natura cannibalizzanti. Oggi tocca all'euro.
|
||||
Anche perché le altre hanno praticamente perso tutte tutto.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<p v-if="error">Non è stato possibile caricare gli articoli. Riprova più tardi.</p>
|
||||
|
||||
<p v-else-if="!featured">Non è stato ancora pubblicato nulla.</p>
|
||||
|
||||
<template v-else>
|
||||
<article class="featured">
|
||||
<NuxtLinkLocale
|
||||
<article class="featured" :class="{ 'has-cover': featuredCover }">
|
||||
<NuxtLink
|
||||
v-if="featuredCover"
|
||||
class="featured-cover"
|
||||
:to="`/blog/${featured.slug}`"
|
||||
tabindex="-1"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<img
|
||||
v-if="featuredCover"
|
||||
:src="featuredCover"
|
||||
:alt="featured.cover?.alternativeText ?? ''"
|
||||
:width="featured.cover?.width ?? undefined"
|
||||
:height="featured.cover?.height ?? undefined"
|
||||
>
|
||||
<span v-else class="placeholder" />
|
||||
</NuxtLinkLocale>
|
||||
</NuxtLink>
|
||||
|
||||
<div class="featured-text">
|
||||
<p class="kicker">
|
||||
{{ featured.category ? featured.category.name : $t('home.latest') }}
|
||||
{{ featured.category ? featured.category.name : 'Ultimo' }}
|
||||
</p>
|
||||
<h1>
|
||||
<NuxtLinkLocale :to="`/blog/${featured.slug}`">{{ featured.title }}</NuxtLinkLocale>
|
||||
</h1>
|
||||
<h2>
|
||||
<NuxtLink :to="`/blog/${featured.slug}`">{{ featured.title }}</NuxtLink>
|
||||
</h2>
|
||||
<p class="kicker date">
|
||||
<time :datetime="isoDate(featured.publishedAt)">
|
||||
{{ formatDate(featured.publishedAt, locale) }}
|
||||
{{ formatDate(featured.publishedAt) }}
|
||||
</time>
|
||||
</p>
|
||||
<p class="read-more">
|
||||
<NuxtLinkLocale :to="`/blog/${featured.slug}`">
|
||||
{{ $t('home.readArticle') }}
|
||||
</NuxtLinkLocale>
|
||||
<NuxtLink :to="`/blog/${featured.slug}`">
|
||||
Leggi l'ultimo articolo
|
||||
</NuxtLink>
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<template v-if="rest.length">
|
||||
<h2 class="section-heading kicker">{{ $t('home.moreStories') }}</h2>
|
||||
|
||||
<ul class="card-grid">
|
||||
<li v-for="article in rest" :key="article.slug">
|
||||
<ArticleCard :article="article" />
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<p class="more">
|
||||
<NuxtLinkLocale to="/blog">{{ $t('home.viewAll') }}</NuxtLinkLocale>
|
||||
</p>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.landing {
|
||||
max-width: var(--width-prose);
|
||||
margin-inline: auto;
|
||||
margin-bottom: var(--gap-section);
|
||||
padding-bottom: var(--gap-section);
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.landing-image {
|
||||
width: 100%;
|
||||
aspect-ratio: 16 / 9;
|
||||
object-fit: cover;
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.landing h1 {
|
||||
margin-block: 1.75rem;
|
||||
font-size: clamp(2rem, 4.5vw, 3.1rem);
|
||||
}
|
||||
|
||||
.landing-text {
|
||||
margin-top: 1.75rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.landing-text p {
|
||||
margin-top: 1.1rem;
|
||||
}
|
||||
|
||||
.featured {
|
||||
display: grid;
|
||||
gap: 2.5rem;
|
||||
gap: 1.5rem;
|
||||
align-items: center;
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
@media (min-width: 52rem) {
|
||||
.featured {
|
||||
/* Stacked on phones and portrait tablets — a side-by-side split below this
|
||||
width leaves both the image and the headline too cramped to read. The split
|
||||
also needs a cover to sit in it, or one column would just be empty. */
|
||||
@media (min-width: 64rem) {
|
||||
.featured.has-cover {
|
||||
grid-template-columns: 1.35fr 1fr;
|
||||
gap: 3.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Without a cover the headline is the whole lead, so it gets the full width
|
||||
but stays inside a readable measure. */
|
||||
.featured:not(.has-cover) .featured-text {
|
||||
max-width: 46rem;
|
||||
}
|
||||
|
||||
.featured-cover {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.featured-cover img,
|
||||
.placeholder {
|
||||
.featured-cover img {
|
||||
width: 100%;
|
||||
aspect-ratio: 3 / 2;
|
||||
object-fit: cover;
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.featured h1 {
|
||||
.featured h2 {
|
||||
margin-top: 0.6rem;
|
||||
font-size: clamp(2rem, 4.5vw, 3.1rem);
|
||||
}
|
||||
|
||||
.featured h1 a {
|
||||
.featured h2 a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.featured h1 a:hover {
|
||||
.featured h2 a:hover {
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 0.12em;
|
||||
}
|
||||
@@ -154,27 +209,4 @@ useSeoMeta({
|
||||
text-decoration: none;
|
||||
border-bottom: 1px solid var(--color-ink);
|
||||
}
|
||||
|
||||
.more {
|
||||
margin-top: 4rem;
|
||||
text-align: center;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.14em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.more a {
|
||||
padding: 0.85rem 2.5rem;
|
||||
text-decoration: none;
|
||||
border: 1px solid var(--color-ink);
|
||||
color: var(--color-ink);
|
||||
display: inline-block;
|
||||
transition: background 0.2s ease, color 0.2s ease;
|
||||
}
|
||||
|
||||
.more a:hover {
|
||||
background: var(--color-ink);
|
||||
color: var(--color-bg);
|
||||
}
|
||||
</style>
|
||||
@@ -1,52 +0,0 @@
|
||||
{
|
||||
"site": {
|
||||
"tagline": "Articles, guides and analysis.",
|
||||
"skipToContent": "Skip to content",
|
||||
"mainNavigation": "Main navigation",
|
||||
"languageLabel": "Language",
|
||||
"allArticles": "All articles",
|
||||
"home": "Home",
|
||||
"browse": "Browse",
|
||||
"categories": "Categories",
|
||||
"contact": "Contact",
|
||||
"noCategories": "Nothing published yet",
|
||||
"rights": "All rights reserved.",
|
||||
"follow": "Follow"
|
||||
},
|
||||
"home": {
|
||||
"latest": "Latest",
|
||||
"readArticle": "Read the article",
|
||||
"moreStories": "More stories",
|
||||
"viewAll": "View all articles"
|
||||
},
|
||||
"list": {
|
||||
"archive": "The archive",
|
||||
"articles": "Articles",
|
||||
"articlesPage": "Articles — page {page}",
|
||||
"archiveDescription": "Every article published on the blog.",
|
||||
"category": "Category",
|
||||
"categoryDescription": "Every article in the {name} category.",
|
||||
"loading": "Loading…",
|
||||
"empty": "Nothing has been published yet.",
|
||||
"categoryEmpty": "There are no articles in this category.",
|
||||
"failed": "Articles could not be loaded. Please try again later."
|
||||
},
|
||||
"pagination": {
|
||||
"label": "Pagination",
|
||||
"previous": "Previous page",
|
||||
"next": "Next page",
|
||||
"position": "Page {page} of {total}"
|
||||
},
|
||||
"article": {
|
||||
"breadcrumb": "Breadcrumb",
|
||||
"back": "Back to all articles",
|
||||
"by": "By {name}"
|
||||
},
|
||||
"error": {
|
||||
"notFoundTitle": "Page not found",
|
||||
"notFoundBody": "The page you are looking for does not exist or has moved.",
|
||||
"genericTitle": "Something went wrong",
|
||||
"genericBody": "Please try again in a moment.",
|
||||
"backHome": "Back to home"
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
{
|
||||
"site": {
|
||||
"tagline": "Artículos, guías y análisis.",
|
||||
"skipToContent": "Ir al contenido",
|
||||
"mainNavigation": "Navegación principal",
|
||||
"languageLabel": "Idioma",
|
||||
"allArticles": "Todos los artículos",
|
||||
"home": "Inicio",
|
||||
"browse": "Explorar",
|
||||
"categories": "Categorías",
|
||||
"contact": "Contacto",
|
||||
"noCategories": "Aún no hay publicaciones",
|
||||
"rights": "Todos los derechos reservados.",
|
||||
"follow": "Síguenos"
|
||||
},
|
||||
"home": {
|
||||
"latest": "Último",
|
||||
"readArticle": "Leer el artículo",
|
||||
"moreStories": "Más artículos",
|
||||
"viewAll": "Ver todos los artículos"
|
||||
},
|
||||
"list": {
|
||||
"archive": "El archivo",
|
||||
"articles": "Artículos",
|
||||
"articlesPage": "Artículos — página {page}",
|
||||
"archiveDescription": "Todos los artículos publicados en el blog.",
|
||||
"category": "Categoría",
|
||||
"categoryDescription": "Todos los artículos de la categoría {name}.",
|
||||
"loading": "Cargando…",
|
||||
"empty": "Todavía no se ha publicado nada.",
|
||||
"categoryEmpty": "No hay artículos en esta categoría.",
|
||||
"failed": "No se han podido cargar los artículos. Inténtalo de nuevo más tarde."
|
||||
},
|
||||
"pagination": {
|
||||
"label": "Paginación",
|
||||
"previous": "Página anterior",
|
||||
"next": "Página siguiente",
|
||||
"position": "Página {page} de {total}"
|
||||
},
|
||||
"article": {
|
||||
"breadcrumb": "Ruta de navegación",
|
||||
"back": "Volver a todos los artículos",
|
||||
"by": "Por {name}"
|
||||
},
|
||||
"error": {
|
||||
"notFoundTitle": "Página no encontrada",
|
||||
"notFoundBody": "La página que buscas no existe o se ha movido.",
|
||||
"genericTitle": "Algo ha salido mal",
|
||||
"genericBody": "Inténtalo de nuevo en unos instantes.",
|
||||
"backHome": "Volver al inicio"
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
{
|
||||
"site": {
|
||||
"tagline": "Articles, guides et analyses.",
|
||||
"skipToContent": "Aller au contenu",
|
||||
"mainNavigation": "Navigation principale",
|
||||
"languageLabel": "Langue",
|
||||
"allArticles": "Tous les articles",
|
||||
"home": "Accueil",
|
||||
"browse": "Parcourir",
|
||||
"categories": "Catégories",
|
||||
"contact": "Contact",
|
||||
"noCategories": "Rien n'a encore été publié",
|
||||
"rights": "Tous droits réservés.",
|
||||
"follow": "Suivez-nous"
|
||||
},
|
||||
"home": {
|
||||
"latest": "Dernier",
|
||||
"readArticle": "Lire l'article",
|
||||
"moreStories": "Autres articles",
|
||||
"viewAll": "Voir tous les articles"
|
||||
},
|
||||
"list": {
|
||||
"archive": "Les archives",
|
||||
"articles": "Articles",
|
||||
"articlesPage": "Articles — page {page}",
|
||||
"archiveDescription": "Tous les articles publiés sur le blog.",
|
||||
"category": "Catégorie",
|
||||
"categoryDescription": "Tous les articles de la catégorie {name}.",
|
||||
"loading": "Chargement…",
|
||||
"empty": "Rien n'a encore été publié.",
|
||||
"categoryEmpty": "Il n'y a aucun article dans cette catégorie.",
|
||||
"failed": "Les articles n'ont pas pu être chargés. Veuillez réessayer plus tard."
|
||||
},
|
||||
"pagination": {
|
||||
"label": "Pagination",
|
||||
"previous": "Page précédente",
|
||||
"next": "Page suivante",
|
||||
"position": "Page {page} sur {total}"
|
||||
},
|
||||
"article": {
|
||||
"breadcrumb": "Fil d'Ariane",
|
||||
"back": "Retour à tous les articles",
|
||||
"by": "Par {name}"
|
||||
},
|
||||
"error": {
|
||||
"notFoundTitle": "Page introuvable",
|
||||
"notFoundBody": "La page que vous cherchez n'existe pas ou a été déplacée.",
|
||||
"genericTitle": "Une erreur est survenue",
|
||||
"genericBody": "Veuillez réessayer dans un instant.",
|
||||
"backHome": "Retour à l'accueil"
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
{
|
||||
"site": {
|
||||
"tagline": "Articoli, guide e analisi.",
|
||||
"skipToContent": "Vai al contenuto",
|
||||
"mainNavigation": "Navigazione principale",
|
||||
"languageLabel": "Lingua",
|
||||
"allArticles": "Tutti gli articoli",
|
||||
"home": "Home",
|
||||
"browse": "Naviga",
|
||||
"categories": "Categorie",
|
||||
"contact": "Contatti",
|
||||
"noCategories": "Ancora nessuna pubblicazione",
|
||||
"rights": "Tutti i diritti riservati.",
|
||||
"follow": "Seguici"
|
||||
},
|
||||
"home": {
|
||||
"latest": "Ultimo",
|
||||
"readArticle": "Leggi l'articolo",
|
||||
"moreStories": "Altri articoli",
|
||||
"viewAll": "Vedi tutti gli articoli"
|
||||
},
|
||||
"list": {
|
||||
"archive": "L'archivio",
|
||||
"articles": "Articoli",
|
||||
"articlesPage": "Articoli — pagina {page}",
|
||||
"archiveDescription": "Tutti gli articoli pubblicati sul blog.",
|
||||
"category": "Categoria",
|
||||
"categoryDescription": "Tutti gli articoli nella categoria {name}.",
|
||||
"loading": "Caricamento…",
|
||||
"empty": "Non è stato ancora pubblicato nulla.",
|
||||
"categoryEmpty": "Non ci sono articoli in questa categoria.",
|
||||
"failed": "Non è stato possibile caricare gli articoli. Riprova più tardi."
|
||||
},
|
||||
"pagination": {
|
||||
"label": "Paginazione",
|
||||
"previous": "Pagina precedente",
|
||||
"next": "Pagina successiva",
|
||||
"position": "Pagina {page} di {total}"
|
||||
},
|
||||
"article": {
|
||||
"breadcrumb": "Percorso di navigazione",
|
||||
"back": "Torna a tutti gli articoli",
|
||||
"by": "Di {name}"
|
||||
},
|
||||
"error": {
|
||||
"notFoundTitle": "Pagina non trovata",
|
||||
"notFoundBody": "La pagina che cerchi non esiste o è stata spostata.",
|
||||
"genericTitle": "Qualcosa è andato storto",
|
||||
"genericBody": "Riprova tra qualche istante.",
|
||||
"backHome": "Torna alla home"
|
||||
}
|
||||
}
|
||||
+1
-23
@@ -5,12 +5,11 @@ export default defineNuxtConfig({
|
||||
compatibilityDate: '2025-07-15',
|
||||
devtools: { enabled: true },
|
||||
|
||||
modules: ['@nuxtjs/i18n'],
|
||||
|
||||
css: ['~/assets/css/main.css'],
|
||||
|
||||
app: {
|
||||
head: {
|
||||
htmlAttrs: { lang: 'it' },
|
||||
titleTemplate: `%s · ${SITE_NAME}`,
|
||||
meta: [{ name: 'viewport', content: 'width=device-width, initial-scale=1' }],
|
||||
link: [
|
||||
@@ -20,27 +19,6 @@ export default defineNuxtConfig({
|
||||
},
|
||||
},
|
||||
|
||||
i18n: {
|
||||
// English keeps the bare URLs; the others are prefixed (/it/blog, /es/blog…).
|
||||
defaultLocale: 'en',
|
||||
strategy: 'prefix_except_default',
|
||||
locales: [
|
||||
{ code: 'en', language: 'en-GB', name: 'English', file: 'en.json' },
|
||||
{ code: 'it', language: 'it-IT', name: 'Italiano', file: 'it.json' },
|
||||
{ code: 'es', language: 'es-ES', name: 'Español', file: 'es.json' },
|
||||
{ code: 'fr', language: 'fr-FR', name: 'Français', file: 'fr.json' },
|
||||
],
|
||||
// First visit follows the browser language; after that the cookie wins.
|
||||
detectBrowserLanguage: {
|
||||
useCookie: true,
|
||||
cookieKey: 'locale',
|
||||
redirectOn: 'root',
|
||||
},
|
||||
// Overridden per environment with NUXT_PUBLIC_I18N_BASE_URL, so the
|
||||
// alternate-language links are absolute and correct in production.
|
||||
baseUrl: 'http://localhost:3000',
|
||||
},
|
||||
|
||||
runtimeConfig: {
|
||||
// Server-only: internal Strapi address, never exposed to the browser.
|
||||
strapiUrl: 'http://localhost:1337',
|
||||
|
||||
Generated
+1
-2766
File diff suppressed because it is too large.
Load diff
@@ -11,7 +11,6 @@
|
||||
"typecheck": "nuxt typecheck"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nuxtjs/i18n": "^10.6.0",
|
||||
"marked": "^18.0.11",
|
||||
"nuxt": "^4.5.2",
|
||||
"simple-icons": "^16.28.0",
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 404 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 88 KiB |
@@ -1,13 +1,13 @@
|
||||
/** Human-readable date for display; returns an empty string when unset. */
|
||||
export function formatDate(value: string | null | undefined, locale = 'en-GB'): string {
|
||||
export function formatDate(value: string | null | undefined): string {
|
||||
if (!value) return ''
|
||||
return new Intl.DateTimeFormat(locale, { dateStyle: 'long' }).format(new Date(value))
|
||||
return new Intl.DateTimeFormat('it-IT', { dateStyle: 'long' }).format(new Date(value))
|
||||
}
|
||||
|
||||
/** Date and time of publication, shown in the article byline. */
|
||||
export function formatDateTime(value: string | null | undefined, locale = 'en-GB'): string {
|
||||
export function formatDateTime(value: string | null | undefined): string {
|
||||
if (!value) return ''
|
||||
return new Intl.DateTimeFormat(locale, { dateStyle: 'long', timeStyle: 'short' })
|
||||
return new Intl.DateTimeFormat('it-IT', { dateStyle: 'long', timeStyle: 'short' })
|
||||
.format(new Date(value))
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user