Compare commits

...
6 Commits
Author SHA1 Message Date
davide 754b84e5f6 temp 2026-09-08 23:34:42 +02:00
davide 91b61caa37 Simplify home page and nav to a single latest-article link
Home now shows only the latest article, pointing to the full list on
/blog instead of duplicating recent articles in a grid. Nav trims to
Home, Tutti gli articoli, and the corralito page; the footer drops the
now-redundant Categorie column.
2026-08-27 13:35:29 +02:00
davide b7bb664c95 Add landing page content and a courses page, restyle both
Turn the home page into a single-column feature: a lead image, the
opening statement as the page's sole h1, a second image, and the body
copy, with the existing latest-articles section still below. Add a new
static page for the crypto courses pitch ("come difendersi dal
corralito"), styled like an article with a cover image and a contact
CTA (email + Telegram) instead of the referenced but nonexistent
contact form. Link the new page from the header nav and footer.
2026-08-26 10:46:46 +02:00
davide 809b60d85e Remove i18n, keep only Italian and rely on browser translation
The interface was translated in en/it/es/fr via @nuxtjs/i18n. Drop the
module, the locale files, and the language switcher: the UI is now
static Italian text, with translation for foreign visitors left to the
Google Translate browser extension instead of the app.
2026-08-26 09:39:05 +02:00
davide 448dd881e4 Ignore ops/ (holds VPS credentials, never commit) 2026-08-25 20:07:09 +02:00
davide 8021ea7254 Route every Strapi plugin path to the CMS, not just /admin
Strapi mounts each plugin's admin API at its own top-level path
(/content-manager, /upload, /i18n, ...), not nested under /admin as
previously assumed. That broke the dashboard widgets: recent/count
documents calls landed on the frontend instead of Strapi. List every
prefix actually used by the installed plugins (core-bundled ones plus
users-permissions and cloud from cms/package.json) explicitly in the
Caddyfile.
2026-08-25 20:06:40 +02:00
36 changed files with 553 additions and 3242 deletions

No files matched your search

+3
View File
@@ -10,6 +10,9 @@ node_modules/
*.pem
*.key
# ops (holds VPS credentials, never commit)
ops/
# nuxt
frontend/.nuxt/
frontend/.output/
+13 -10
View File
@@ -16,13 +16,16 @@ sitemap e `robots.txt` dinamici, ricerca, e i test (nessun framework ancora conf
## Architettura
```text
Browser → Caddy ─┬─ /admin, /uploads → Strapi 5 → PostgreSQL
└─ tutto il resto → Nuxt 4 (SSR) → REST Strapi
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,
sotto `/admin` e `/uploads`, il pannello Strapi (Strapi 5 annida l'intera admin UI e la sua
API sotto `/admin`, senza toccare `/api`). Un solo dominio, un solo certificato TLS.
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.
@@ -37,11 +40,11 @@ API sotto `/admin`, senza toccare `/api`). Un solo dominio, un solo certificato
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.
+6 -6
View File
@@ -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 ─┬─ /admin, /uploads → Strapi (CMS) → PostgreSQL
└─ everything else → Nuxt (website)
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
@@ -94,7 +94,7 @@ reachable inside the Docker network — do not publish their ports.
| `PUBLIC_DOMAIN` | `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://example.com` — same origin, Caddy proxies `/admin` and `/uploads` to Strapi |
| `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 —
@@ -111,9 +111,9 @@ already ignored.
docker compose up -d --build
```
This time Caddy is included: it serves both the website and, under `/admin` and
`/uploads`, the CMS on `PUBLIC_DOMAIN`, obtains and renews the TLS certificate 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://example.com/admin`, immediately,
before anyone else finds the URL — the first visitor to that form is the one who gets the
+12 -5
View File
@@ -16,11 +16,18 @@
import security_headers
encode zstd gzip
# /admin and /uploads go to Strapi; everything else to the frontend.
# Strapi 5 nests the whole admin panel (UI + its own API) under /admin,
# so this single prefix is enough - it never touches /api, which stays
# reserved for the frontend's own Nitro endpoints.
@cms path /admin* /uploads*
# 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 {
@@ -11,31 +11,41 @@
"draftAndPublish": true,
"populateCreatorFields": true
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"title": {
"type": "string",
"required": true,
"maxLength": 160
"maxLength": 160,
"pluginOptions": { "i18n": { "localized": true } }
},
"slug": {
"type": "uid",
"targetField": "title",
"required": true
"required": true,
"pluginOptions": { "i18n": { "localized": false } }
},
"content": {
"type": "richtext",
"required": true
"required": true,
"pluginOptions": { "i18n": { "localized": true } }
},
"cover": {
"type": "media",
"multiple": false,
"allowedTypes": ["images"]
"allowedTypes": ["images"],
"pluginOptions": { "i18n": { "localized": false } }
},
"category": {
"type": "relation",
"relation": "manyToOne",
"target": "api::category.category",
"inversedBy": "articles"
"inversedBy": "articles",
"pluginOptions": { "i18n": { "localized": false } }
}
}
}
@@ -10,22 +10,30 @@
"options": {
"draftAndPublish": false
},
"pluginOptions": {
"i18n": {
"localized": true
}
},
"attributes": {
"name": {
"type": "string",
"required": true,
"unique": true
"unique": true,
"pluginOptions": { "i18n": { "localized": true } }
},
"slug": {
"type": "uid",
"targetField": "name",
"required": true
"required": true,
"pluginOptions": { "i18n": { "localized": false } }
},
"articles": {
"type": "relation",
"relation": "oneToMany",
"target": "api::article.article",
"mappedBy": "category"
"mappedBy": "category",
"pluginOptions": { "i18n": { "localized": false } }
}
}
}
+14
View File
@@ -45,11 +45,25 @@ async function disablePublicSignUp(strapi: Core.Strapi) {
}
}
/**
* The site content is authored in Italian and English. Strapi ships with only
* the default `it` locale, so the `en` locale is created here if missing.
*/
async function ensureEnglishLocale(strapi: Core.Strapi) {
const locales = strapi.plugin('i18n').service('locales');
const existing = await locales.find({ where: { code: 'en' } });
if (existing.length === 0) {
await locales.create({ code: 'en', name: 'English (en)', isDefault: false });
}
}
export default {
register() {},
async bootstrap({ strapi }: { strapi: Core.Strapi }) {
await grantPublicReadAccess(strapi);
await disablePublicSignUp(strapi);
await ensureEnglishLocale(strapi);
},
};
-1
View File
@@ -16,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
-2
View File
@@ -51,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
+2 -2
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
// Emits <html lang>, the alternate-language links and og:locale for every page.
useHead(useLocaleHead())
const { locale } = useLocale()
useHead({ htmlAttrs: { lang: locale } })
</script>
<template>
+4 -4
View File
@@ -3,16 +3,16 @@ 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))
const { locale } = useLocale()
</script>
<template>
<article class="card">
<!-- No placeholder box when there is no cover: an empty grey rectangle
reads as a broken image rather than as a deliberate choice. -->
<NuxtLinkLocale
<NuxtLink
v-if="cover"
class="cover-link"
:to="`/blog/${article.slug}`"
@@ -27,12 +27,12 @@ const cover = computed(() => mediaUrl(props.article.cover))
:height="article.cover?.height ?? undefined"
loading="lazy"
>
</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">
@@ -1,80 +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.4rem 1.7rem 0.4rem 0.7rem;
border: 1px solid var(--color-border);
border-radius: 0;
background: transparent;
color: var(--color-body);
font: inherit;
/* Safari on iOS zooms the page when a control smaller than 16px is tapped,
so the picker stays at 1rem on phones and shrinks only from tablet up. */
font-size: 1rem;
font-weight: 600;
letter-spacing: 0.14em;
text-transform: uppercase;
cursor: pointer;
}
@media (min-width: 48rem) {
select {
padding: 0.35rem 1.6rem 0.35rem 0.7rem;
font-size: 0.75rem;
}
}
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>
+21
View File
@@ -0,0 +1,21 @@
import { STRINGS, type Strings } from '../i18n/strings'
export type Locale = 'it' | 'en'
/**
* Site language, persisted in a cookie so SSR renders the right language on
* the first request. `t(key)` reads the current locale's UI string.
*/
export function useLocale() {
const locale = useCookie<Locale>('lang', { default: () => 'it', sameSite: 'lax' })
function setLocale(value: Locale) {
locale.value = value
}
function t<K extends keyof Strings>(key: K): Strings[K] {
return STRINGS[locale.value][key]
}
return { locale, setLocale, t }
}
+5 -4
View File
@@ -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>
+104
View File
@@ -0,0 +1,104 @@
/** Static UI strings, keyed once and translated for each supported locale. */
export interface Strings {
skipToContent: string
tagline: string
navHome: string
navAllArticles: string
navCorralito: string
navPrimary: string
footerNavigate: string
footerFollow: string
footerContact: string
footerRights: string
switchLanguage: string
loadError: string
noArticlesYet: string
latestFallback: string
readArticle: string
seeAllArticles: string
archiveKicker: string
articlesTitle: string
allArticlesDescription: string
pagePrefix: string
loading: string
pagination: string
prevPage: string
nextPage: string
pageOf: (page: number, pageCount: number) => string
breadcrumbArticles: string
byAuthor: (name: string) => string
backToArticles: string
categoryKicker: string
categoryDescription: (name: string) => string
noArticlesInCategory: string
}
export const STRINGS: Record<'it' | 'en', Strings> = {
it: {
skipToContent: 'Vai al contenuto',
tagline: 'Articoli, guide e analisi.',
navHome: 'Home',
navAllArticles: 'Tutti gli articoli',
navCorralito: 'Come difendersi dal corralito',
navPrimary: 'Navigazione principale',
footerNavigate: 'Naviga',
footerFollow: 'Seguici',
footerContact: 'Contatti:',
footerRights: 'Tutti i diritti riservati.',
switchLanguage: 'English',
loadError: 'Non è stato possibile caricare gli articoli. Riprova più tardi.',
noArticlesYet: 'Non è stato ancora pubblicato nulla.',
latestFallback: 'Ultimo',
readArticle: "Leggi l'articolo",
seeAllArticles: 'Vedi tutti gli articoli',
archiveKicker: "L'archivio",
articlesTitle: 'Articoli',
allArticlesDescription: 'Tutti gli articoli pubblicati sul blog.',
pagePrefix: 'pagina',
loading: 'Caricamento…',
pagination: 'Paginazione',
prevPage: 'Pagina precedente',
nextPage: 'Pagina successiva',
pageOf: (page: number, pageCount: number) => `Pagina ${page} di ${pageCount}`,
breadcrumbArticles: 'Articoli',
byAuthor: (name: string) => `Di ${name}`,
backToArticles: 'Torna a tutti gli articoli',
categoryKicker: 'Categoria',
categoryDescription: (name: string) => `Tutti gli articoli nella categoria ${name}.`,
noArticlesInCategory: 'Non ci sono articoli in questa categoria.',
},
en: {
skipToContent: 'Skip to content',
tagline: 'Articles, guides and analysis.',
navHome: 'Home',
navAllArticles: 'All articles',
navCorralito: 'Come difendersi dal corralito',
navPrimary: 'Main navigation',
footerNavigate: 'Navigate',
footerFollow: 'Follow',
footerContact: 'Contact:',
footerRights: 'All rights reserved.',
switchLanguage: 'Italiano',
loadError: 'The articles could not be loaded. Please try again later.',
noArticlesYet: 'Nothing has been published yet.',
latestFallback: 'Latest',
readArticle: 'Read the article',
seeAllArticles: 'See all articles',
archiveKicker: 'The archive',
articlesTitle: 'Articles',
allArticlesDescription: 'All articles published on the blog.',
pagePrefix: 'page',
loading: 'Loading…',
pagination: 'Pagination',
prevPage: 'Previous page',
nextPage: 'Next page',
pageOf: (page: number, pageCount: number) => `Page ${page} of ${pageCount}`,
breadcrumbArticles: 'Articles',
byAuthor: (name: string) => `By ${name}`,
backToArticles: 'Back to all articles',
categoryKicker: 'Category',
categoryDescription: (name: string) => `All articles in the ${name} category.`,
noArticlesInCategory: 'There are no articles in this category.',
},
}
+54 -48
View File
@@ -1,39 +1,43 @@
<script setup lang="ts">
import type { Category } from '#shared/types/blog'
const { locale, setLocale, t } = useLocale()
const { locale } = useI18n()
const otherLocale = computed(() => (locale.value === 'it' ? 'en' : 'it'))
const { data: categories } = await useFetch<Category[]>('/api/categories', {
key: 'nav-categories',
default: () => [],
})
/**
* Switches the site language. On an article/category page, jumps to the
* translated counterpart's slug if one exists; elsewhere reloads the current
* route so it refetches its content in the new language.
*/
function switchLanguage() {
setLocale(otherLocale.value)
reloadNuxtApp({ path: useRoute().fullPath })
}
</script>
<template>
<div class="page">
<a class="skip-link" href="#main">{{ $t('site.skipToContent') }}</a>
<a class="skip-link" href="#main">{{ t('skipToContent') }}</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">{{ t('tagline') }}</p>
</div>
<nav class="site-nav" :aria-label="$t('site.mainNavigation')">
<nav class="site-nav" :aria-label="t('navPrimary')">
<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="/">{{ t('navHome') }}</NuxtLink></li>
<li><NuxtLink to="/blog">{{ t('navAllArticles') }}</NuxtLink></li>
<li><NuxtLink to="/come-difendersi-dal-corralito">{{ t('navCorralito') }}</NuxtLink></li>
</ul>
<LanguageSwitcher />
<button type="button" class="lang-switch" @click="switchLanguage">
{{ t('switchLanguage') }}
</button>
</div>
</nav>
</header>
@@ -46,35 +50,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">{{ t('tagline') }}</p>
<address class="contact">
{{ $t('site.contact') }}:
{{ t('footerContact') }}
<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="t('footerNavigate')">
<p class="kicker">{{ t('footerNavigate') }}</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="/">{{ t('navHome') }}</NuxtLink></li>
<li><NuxtLink to="/blog">{{ t('navAllArticles') }}</NuxtLink></li>
<li><NuxtLink to="/come-difendersi-dal-corralito">{{ t('navCorralito') }}</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="t('footerFollow')">
<p class="kicker">{{ t('footerFollow') }}</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 +79,8 @@ const { data: categories } = await useFetch<Category[]>('/api/categories', {
</nav>
</div>
<p class="container copyright kicker" :lang="locale">
&copy; {{ new Date().getFullYear() }} {{ SITE_NAME }}. {{ $t('site.rights') }}
<p class="container copyright kicker">
&copy; {{ new Date().getFullYear() }} {{ SITE_NAME }}. {{ t('footerRights') }}
</p>
</footer>
</div>
@@ -137,13 +130,12 @@ const { data: categories } = await useFetch<Category[]>('/api/categories', {
border-top: 1px solid var(--color-border);
}
/* Phones stack the links above the language picker, both centred; from tablet
up they sit on one line with the picker pushed to the right. */
.nav-inner {
display: flex;
flex-direction: column;
flex-wrap: wrap;
justify-content: center;
align-items: center;
gap: 0.5rem;
gap: 0.75rem 1.5rem;
padding-block: 0.6rem;
}
@@ -161,16 +153,30 @@ const { data: categories } = await useFetch<Category[]>('/api/categories', {
text-transform: uppercase;
}
.lang-switch {
font: inherit;
font-size: 0.75rem;
font-weight: 600;
letter-spacing: 0.14em;
text-transform: uppercase;
padding: 0.35rem 0.75rem;
color: var(--color-body);
background: none;
border: 1px solid var(--color-border);
cursor: pointer;
}
.lang-switch:hover {
color: var(--color-ink);
border-color: var(--color-ink);
}
@media (min-width: 48rem) {
.site-nav {
margin-top: 2rem;
}
.nav-inner {
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
gap: 0.75rem 2rem;
padding-block: 0.9rem;
}
+13 -8
View File
@@ -1,11 +1,15 @@
<script setup lang="ts">
import type { Article } from '#shared/types/blog'
const { locale } = useI18n()
const route = useRoute()
const slug = route.params.slug as string
const { data: article } = await useFetch<Article>(`/api/articles/${slug}`)
const { locale, t } = useLocale()
const { data: article } = await useFetch<Article>(`/api/articles/${slug}`, {
key: () => `article-${slug}-${locale.value}`,
query: { lang: locale },
})
if (!article.value) {
throw createError({ statusCode: 404, statusMessage: 'Article not found', fatal: true })
@@ -39,6 +43,7 @@ useHead({
headline: article.value.title,
description: article.value.summary,
datePublished: isoDate(article.value.publishedAt),
inLanguage: locale.value,
author: article.value.author
? { '@type': 'Person', name: article.value.author }
: undefined,
@@ -53,13 +58,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">{{ t('breadcrumbArticles') }}</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>
@@ -71,7 +76,7 @@ useHead({
</time>
<template v-if="article.author">
<span aria-hidden="true"> · </span>
<span>{{ $t('article.by', { name: article.author }) }}</span>
<span>{{ t('byAuthor')(article.author) }}</span>
</template>
</p>
</header>
@@ -89,7 +94,7 @@ useHead({
<div class="prose" v-html="article.html" />
<p class="back">
<NuxtLinkLocale to="/blog">{{ $t('article.back') }}</NuxtLinkLocale>
<NuxtLink to="/blog">{{ t('backToArticles') }}</NuxtLink>
</p>
</article>
</template>
+15 -13
View File
@@ -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(() => {
@@ -9,8 +8,11 @@ const page = computed(() => {
return Number.isInteger(value) && value > 0 ? value : 1
})
const { locale, t } = useLocale()
const { data, error, status } = await useFetch<Paginated<ArticleSummary>>('/api/articles', {
query: { page },
key: () => `blog-articles-${locale.value}-${page.value}`,
query: { page, lang: locale },
})
const { public: config } = useRuntimeConfig()
@@ -19,8 +21,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 ? `${t('articlesTitle')} — ${t('pagePrefix')} ${page.value}` : t('articlesTitle')),
description: () => t('allArticlesDescription'),
ogType: 'website',
})
@@ -30,15 +32,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">{{ t('archiveKicker') }}</p>
<h1>{{ t('articlesTitle') }}</h1>
</header>
<p v-if="error">{{ $t('list.failed') }}</p>
<p v-if="error">{{ t('loadError') }}</p>
<p v-else-if="status === 'pending'">{{ $t('list.loading') }}</p>
<p v-else-if="status === 'pending'">{{ t('loading') }}</p>
<p v-else-if="!data?.items.length">{{ $t('list.empty') }}</p>
<p v-else-if="!data?.items.length">{{ t('noArticlesYet') }}</p>
<template v-else>
<ul class="card-grid">
@@ -47,19 +49,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="t('pagination')">
<NuxtLink v-if="data.page > 1" :to="{ query: { page: data.page - 1 } }" rel="prev">
{{ $t('pagination.previous') }}
{{ t('prevPage') }}
</NuxtLink>
<span class="muted">
{{ $t('pagination.position', { page: data.page, total: data.pageCount }) }}
{{ t('pageOf')(data.page, data.pageCount) }}
</span>
<NuxtLink
v-if="data.page < data.pageCount"
:to="{ query: { page: data.page + 1 } }"
rel="next"
>
{{ $t('pagination.next') }}
{{ t('nextPage') }}
</NuxtLink>
</nav>
</template>
+17 -12
View File
@@ -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
@@ -10,14 +9,20 @@ const page = computed(() => {
return Number.isInteger(value) && value > 0 ? value : 1
})
const { data: category } = await useFetch<Category>(`/api/categories/${slug}`)
const { locale, t } = useLocale()
const { data: category } = await useFetch<Category>(`/api/categories/${slug}`, {
key: () => `category-${slug}-${locale.value}`,
query: { lang: locale },
})
if (!category.value) {
throw createError({ statusCode: 404, statusMessage: 'Category not found', fatal: true })
}
const { data, error } = await useFetch<Paginated<ArticleSummary>>('/api/articles', {
query: { page, category: slug },
key: () => `category-articles-${slug}-${locale.value}-${page.value}`,
query: { page, category: slug, lang: locale },
})
const { public: config } = useRuntimeConfig()
@@ -26,8 +31,8 @@ const canonical = computed(
)
useSeoMeta({
title: category.value.name,
description: () => t('list.categoryDescription', { name: category.value?.name ?? '' }),
title: () => category.value?.name ?? '',
description: () => t('categoryDescription')(category.value?.name ?? ''),
ogType: 'website',
})
@@ -37,13 +42,13 @@ useHead({ link: [{ rel: 'canonical', href: canonical }] })
<template>
<div>
<header class="page-header">
<p class="kicker">{{ $t('list.category') }}</p>
<p class="kicker">{{ t('categoryKicker') }}</p>
<h1>{{ category?.name }}</h1>
</header>
<p v-if="error">{{ $t('list.failed') }}</p>
<p v-if="error">{{ t('loadError') }}</p>
<p v-else-if="!data?.items.length">{{ $t('list.categoryEmpty') }}</p>
<p v-else-if="!data?.items.length">{{ t('noArticlesInCategory') }}</p>
<template v-else>
<ul class="card-grid">
@@ -52,19 +57,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="t('pagination')">
<NuxtLink v-if="data.page > 1" :to="{ query: { page: data.page - 1 } }" rel="prev">
{{ $t('pagination.previous') }}
{{ t('prevPage') }}
</NuxtLink>
<span class="muted">
{{ $t('pagination.position', { page: data.page, total: data.pageCount }) }}
{{ t('pageOf')(data.page, data.pageCount) }}
</span>
<NuxtLink
v-if="data.page < data.pageCount"
:to="{ query: { page: data.page + 1 } }"
rel="next"
>
{{ $t('pagination.next') }}
{{ t('nextPage') }}
</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>
+86 -32
View File
@@ -1,16 +1,14 @@
<script setup lang="ts">
import type { ArticleSummary, Paginated } from '#shared/types/blog'
const { t, locale } = useI18n()
const { locale, t } = useLocale()
const { data, error } = await useFetch<Paginated<ArticleSummary>>('/api/articles', {
key: 'home-articles',
query: { page: 1 },
key: () => `home-articles-${locale.value}`,
query: { page: 1, lang: locale },
})
/** 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 +22,9 @@ useHead({ titleTemplate: '%s', link: [{ rel: 'canonical', href: canonical }] })
useSeoMeta({
title: SITE_NAME,
description: () => t('site.tagline'),
description: () => t('tagline'),
ogTitle: SITE_NAME,
ogDescription: () => t('site.tagline'),
ogDescription: () => t('tagline'),
ogType: 'website',
ogUrl: canonical,
ogImage: `${config.siteUrl}/logo.png`,
@@ -35,13 +33,49 @@ 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">{{ t('loadError') }}</p>
<p v-else-if="!featured">{{ t('noArticlesYet') }}</p>
<template v-else>
<article class="featured" :class="{ 'has-cover': featuredCover }">
<NuxtLinkLocale
<NuxtLink
v-if="featuredCover"
class="featured-cover"
:to="`/blog/${featured.slug}`"
@@ -54,46 +88,66 @@ useSeoMeta({
:width="featured.cover?.width ?? undefined"
:height="featured.cover?.height ?? undefined"
>
</NuxtLinkLocale>
</NuxtLink>
<div class="featured-text">
<p class="kicker">
{{ featured.category ? featured.category.name : $t('home.latest') }}
{{ featured.category ? featured.category.name : t('latestFallback') }}
</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) }}
</time>
</p>
<p class="read-more">
<NuxtLinkLocale :to="`/blog/${featured.slug}`">
{{ $t('home.readArticle') }}
</NuxtLinkLocale>
<NuxtLink :to="`/blog/${featured.slug}`">
{{ t('readArticle') }}
</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>
<NuxtLink to="/blog">{{ t('seeAllArticles') }}</NuxtLink>
</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: 1.5rem;
@@ -129,16 +183,16 @@ useSeoMeta({
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;
}
-52
View File
@@ -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"
}
}
-52
View File
@@ -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"
}
}
-52
View File
@@ -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"
}
}
-52
View File
@@ -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
View File
@@ -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',
+1 -2766
View File
File diff suppressed because it is too large. Load diff
-1
View File
@@ -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

+2 -1
View File
@@ -18,13 +18,14 @@ function byline(user: AdminUser | null | undefined): string | null {
export default defineEventHandler(async (event): Promise<Article> => {
const slug = getRouterParam(event, 'slug')
const locale = localeParam(getQuery(event).lang)
if (!slug) {
throw createError({ statusCode: 400, statusMessage: 'Missing article slug' })
}
const response = await strapiFetch<StrapiList<RawArticle>>(
`/api/articles?${ARTICLE_DETAIL_QUERY}&filters[slug][$eq]=${encodeURIComponent(slug)}&pagination[pageSize]=1`
`/api/articles?${ARTICLE_DETAIL_QUERY}&locale=${locale}&filters[slug][$eq]=${encodeURIComponent(slug)}&pagination[pageSize]=1`
)
const article = response.data[0]
+2 -1
View File
@@ -3,6 +3,7 @@ import type { ArticleSummary, Paginated } from '#shared/types/blog'
export default defineEventHandler(async (event): Promise<Paginated<ArticleSummary>> => {
const query = getQuery(event)
const page = pageParam(query.page)
const locale = localeParam(query.lang)
const category = typeof query.category === 'string' ? query.category : null
const filter = category
@@ -10,7 +11,7 @@ export default defineEventHandler(async (event): Promise<Paginated<ArticleSummar
: ''
const response = await strapiFetch<StrapiList<ArticleSummary>>(
`/api/articles?${ARTICLE_SUMMARY_QUERY}&${pagination(page)}${filter}`
`/api/articles?${ARTICLE_SUMMARY_QUERY}&locale=${locale}&${pagination(page)}${filter}`
)
return {
+2 -1
View File
@@ -2,13 +2,14 @@ import type { Category } from '#shared/types/blog'
export default defineEventHandler(async (event): Promise<Category> => {
const slug = getRouterParam(event, 'slug')
const locale = localeParam(getQuery(event).lang)
if (!slug) {
throw createError({ statusCode: 400, statusMessage: 'Missing category slug' })
}
const response = await strapiFetch<StrapiList<Category>>(
`/api/categories?fields[0]=name&fields[1]=slug&filters[slug][$eq]=${encodeURIComponent(slug)}&pagination[pageSize]=1`
`/api/categories?fields[0]=name&fields[1]=slug&locale=${locale}&filters[slug][$eq]=${encodeURIComponent(slug)}&pagination[pageSize]=1`
)
const category = response.data[0]
+4 -2
View File
@@ -1,8 +1,10 @@
import type { Category } from '#shared/types/blog'
export default defineEventHandler(async (): Promise<Category[]> => {
export default defineEventHandler(async (event): Promise<Category[]> => {
const locale = localeParam(getQuery(event).lang)
const response = await strapiFetch<StrapiList<Category>>(
'/api/categories?fields[0]=name&fields[1]=slug&sort[0]=name:asc&pagination[pageSize]=100'
`/api/categories?fields[0]=name&fields[1]=slug&locale=${locale}&sort[0]=name:asc&pagination[pageSize]=100`
)
return response.data
+5
View File
@@ -31,3 +31,8 @@ export const pageParam = (value: unknown): number => {
const page = Number(value)
return Number.isInteger(page) && page > 0 ? page : 1
}
export type Locale = 'it' | 'en'
/** Reads the `lang` query param, falling back to the site default `it`. */
export const localeParam = (value: unknown): Locale => (value === 'en' ? 'en' : 'it')
+9 -4
View File
@@ -1,13 +1,18 @@
const INTL_LOCALE = { it: 'it-IT', en: 'en-GB' } as const
/** 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, locale: 'it' | 'en' = 'it'): string {
if (!value) return ''
return new Intl.DateTimeFormat(locale, { dateStyle: 'long' }).format(new Date(value))
return new Intl.DateTimeFormat(INTL_LOCALE[locale], { 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,
locale: 'it' | 'en' = 'it'
): string {
if (!value) return ''
return new Intl.DateTimeFormat(locale, { dateStyle: 'long', timeStyle: 'short' })
return new Intl.DateTimeFormat(INTL_LOCALE[locale], { dateStyle: 'long', timeStyle: 'short' })
.format(new Date(value))
}