diff --git a/apps/infoalloggi/public/og.jpg b/apps/infoalloggi/public/og.jpg new file mode 100644 index 0000000..5996783 Binary files /dev/null and b/apps/infoalloggi/public/og.jpg differ diff --git a/apps/infoalloggi/src/pages/index.tsx b/apps/infoalloggi/src/pages/index.tsx index 86c9c43..59c6132 100644 --- a/apps/infoalloggi/src/pages/index.tsx +++ b/apps/infoalloggi/src/pages/index.tsx @@ -1,5 +1,6 @@ import { ArrowRight, Telescope } from "lucide-react"; import type { NextPage } from "next"; +import Head from "next/head"; import Link from "next/link"; import { AccordionComp } from "~/components/accordionComp"; import { CodiceBox } from "~/components/codiceRicerca"; @@ -7,36 +8,58 @@ import { PricingChoice } from "~/components/prezzi"; import { HeroSvg, LogoSvg } from "~/components/svgs"; import { Button } from "~/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "~/components/ui/card"; +import { env } from "~/env.mjs"; import type { LangDict } from "~/i18n/locales"; import { useTranslation } from "~/providers/I18nProvider"; const Home: NextPage = () => { const { t } = useTranslation(); - + const description = + "Infoalloggi.it - Trova il tuo alloggio ideale in modo semplice e veloce. Annunci di case, appartamenti e stanze in affitto per studenti, lavoratori e famiglie. Scopri ora gli annunci!"; return ( -
-
-
-
-
- -
-
- - -
-
-
- - - + + + + + + + + + + + + +
+
+
+
+
+ +
+
- + +
+
+
+ + + + + +
-
+ ); }; diff --git a/apps/infoalloggi/src/server/controllers/annunci.controller.ts b/apps/infoalloggi/src/server/controllers/annunci.controller.ts index c4a2807..8fef5ed 100644 --- a/apps/infoalloggi/src/server/controllers/annunci.controller.ts +++ b/apps/infoalloggi/src/server/controllers/annunci.controller.ts @@ -94,17 +94,23 @@ export const getAnnunciMetaByCod = async ({ cod }: { cod: string }) => { try { const annuncio = await db .selectFrom("annunci") - .select(["titolo_it", "desc_it", "og_url"]) + .select(["titolo_it", "desc_it", "og_url", "url_immagini"]) .where("annunci.web", "=", true) .where("codice", "=", cod) .executeTakeFirst(); if (!annuncio) { return null; } + const ogImage = + annuncio.url_immagini && + annuncio.url_immagini.length > 0 && + annuncio.url_immagini[0] + ? annuncio.url_immagini[0] + : annuncio.og_url || ""; return { description: annuncio.desc_it || "", - ogImage: annuncio.og_url || "", + ogImage, ogUrl: `${env.NEXT_PUBLIC_BASE_URL}/annuncio/${cod}`, title: annuncio.titolo_it || "", };