From b64233ac858a445fe26993fb49a0af9ccc5d873b Mon Sep 17 00:00:00 2001 From: Martim Passos <49573683+martimpassos@users.noreply.github.com> Date: Fri, 21 Jun 2024 12:39:13 -0300 Subject: [PATCH] Improve SEO, add eslint and prettier --- .eslintrc.json | 11 +- .github/workflows/nextjs.yml | 10 +- .gitignore | 3 +- .prettierignore | 2 + app/[locale]/layout.tsx | 166 ++- app/[locale]/page.tsx | 20 +- app/globals.css | 8 +- app/layout.tsx | 6 +- app/page.tsx | 7 +- app/robots.txt | 4 + app/sitemap.xml | 16 + messages/en.json | 104 +- messages/pt.json | 104 +- next.config.js | 8 +- package-lock.json | 994 +++++++++++++++++- package.json | 3 + postcss.config.js | 2 +- src/components/About.tsx | 51 +- src/components/ContentBox.jsx | 8 +- .../ContentBoxCarouselFourColumns.jsx | 4 +- .../ContentBoxCarouselTwoColumns.jsx | 4 +- src/components/ContentBoxProject.jsx | 27 +- src/components/ContentBoxSubTitle.jsx | 7 +- src/components/ContentBoxText.jsx | 4 +- src/components/ContentBoxTitle.jsx | 6 +- src/components/Footer.jsx | 4 +- src/components/Hero.jsx | 50 +- src/components/LocaleSwitch.jsx | 14 +- src/components/LocaleSwitcherSelect.tsx | 17 +- src/components/MainContent.jsx | 4 +- src/components/Partners.jsx | 32 +- src/components/Projects.jsx | 56 +- src/components/Team.jsx | 75 +- src/config.ts | 2 +- src/i18n.tsx | 10 +- src/middleware.ts | 16 +- src/navigation.ts | 10 +- styles/globals.css | 3 +- tailwind.config.js | 12 +- theme.config.jsx | 48 +- theme.tsx | 8 +- tsconfig.json | 15 +- 42 files changed, 1542 insertions(+), 413 deletions(-) create mode 100644 .prettierignore create mode 100644 app/robots.txt create mode 100644 app/sitemap.xml diff --git a/.eslintrc.json b/.eslintrc.json index bffb357..c2eed54 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,3 +1,12 @@ { - "extends": "next/core-web-vitals" + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "prettier", + "next/core-web-vitals" + ], + "plugins": ["prettier"], + "rules": { + "prettier/prettier": "error" + } } diff --git a/.github/workflows/nextjs.yml b/.github/workflows/nextjs.yml index fcc8e36..e0b620b 100644 --- a/.github/workflows/nextjs.yml +++ b/.github/workflows/nextjs.yml @@ -56,11 +56,11 @@ jobs: - name: Setup Pages uses: actions/configure-pages@v4 # with: - # Automatically inject basePath in your Next.js configuration file and disable - # server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized). - # - # You may remove this line if you want to manage the configuration yourself. - # static_site_generator: next + # Automatically inject basePath in your Next.js configuration file and disable + # server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized). + # + # You may remove this line if you want to manage the configuration yourself. + # static_site_generator: next - name: Restore cache uses: actions/cache@v3 with: diff --git a/.gitignore b/.gitignore index 1f9fefe..4a403c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules -.next/ \ No newline at end of file +.next/ +out/ \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..07d2252 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +node_modules +out \ No newline at end of file diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx index bbcf347..244b759 100644 --- a/app/[locale]/layout.tsx +++ b/app/[locale]/layout.tsx @@ -1,44 +1,148 @@ -import { ReactNode } from 'react' -import { notFound } from 'next/navigation' -import { NextIntlClientProvider } from 'next-intl' -import {unstable_setRequestLocale} from 'next-intl/server'; -import { Metadata } from 'next' -import '../globals.css' +import { ReactNode } from "react"; +import { notFound } from "next/navigation"; +import { NextIntlClientProvider } from "next-intl"; +import { unstable_setRequestLocale } from "next-intl/server"; +import { Metadata } from "next"; +import "../globals.css"; type Props = { - children: ReactNode - params: { locale: string } - } + children: ReactNode; + params: { locale: string }; +}; -export const metadata: Metadata = { - title: 'ARKA', - description: 'Arka é uma consultoria especializada em gestão de coleções digitais atuando no Brasil e em projetos internacionais.', -} +export const metadata = (locale: string): Metadata => { + const commonMetadata = { + title: "ARKA", + openGraph: { + url: "https://arka.la", + images: [ + { + url: "https://avatars.githubusercontent.com/u/152537545?s=200&v=4", + width: 200, + height: 200, + alt: "Arka Logo", + }, + ], + }, + twitter: { + card: "summary_large_image", + site: "@arka", + images: ["https://avatars.githubusercontent.com/u/152537545?s=200&v=4"], + }, + }; + + let description; + let keywords; + + switch (locale) { + case "en": + description = + "Arka is a digital studio specialized in digital collections, operating in Brazil and abroad"; + keywords = [ + "iiif", + "collections", + "machine learning", + "consultancy", + "digital humanities", + "digital strategy", + "museums", + "galleries", + "archives", + "libraries", + "cultural heritage", + ]; + case "pt": + description = + "Arka é um estúdio digital especializado em coleções digitais, atuando no Brasil e em projetos internacionais"; + keywords = [ + "iiif", + "acervos", + "inteligência artificial", + "patrimônio cultural", + "consultoria", + "humanidades digitais", + "estratégia digital", + "museus", + "galerias", + "arquivos", + "bibliotecas", + ]; + case "es": + description = + "Arka es un estudio digital especializado en colecciones digitales, que opera en Brasil y en el extranjero."; + keywords = [ + "iiif", + "colecciones", + "museos", + "galerias", + "archivos", + "bibliotecas", + "humanidades digitales", + "consultoria", + "estrategia digital", + "patrimonio cultural", + "inteligencia artificial", + ]; + } + return { + description: description, + keywords: keywords, + ...commonMetadata, + openGraph: { + ...commonMetadata.openGraph, + description: description, + }, + twitter: { + ...commonMetadata.twitter, + description: description, + }, + }; +}; //function to get the translations async function getMessages(locale: string) { - try { - return (await import(`../../messages/${locale}.json`)).default - } catch (error) { - notFound() - } + try { + return (await import(`../../messages/${locale}.json`)).default; + } catch (error) { + notFound(); + } } //function to generate the routes for all the locales export async function generateStaticParams() { - return ['en', 'pt'].map((locale) => ({ locale })) + return ["en", "pt"].map((locale) => ({ locale })); } -export default async function RootLayout({ children, params: { locale } }: Props) { - unstable_setRequestLocale(locale); - const messages = await getMessages(locale) - return ( - - - - {children} - - - - ) +export default async function RootLayout({ + children, + params: { locale }, +}: Props) { + unstable_setRequestLocale(locale); + const messages = await getMessages(locale); + return ( + + + + {children} + + +