Skip to content

Commit

Permalink
Improve SEO, add eslint and prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
martimpassos committed Jun 21, 2024
1 parent b719374 commit b64233a
Show file tree
Hide file tree
Showing 42 changed files with 1,542 additions and 413 deletions.
11 changes: 10 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
10 changes: 5 additions & 5 deletions .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules

.next/
.next/
out/
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
out
166 changes: 135 additions & 31 deletions app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<html lang={locale}>
<body>
<NextIntlClientProvider locale={locale} messages={messages}>
{children}
</NextIntlClientProvider>
</body>
</html>
)
export default async function RootLayout({
children,
params: { locale },
}: Props) {
unstable_setRequestLocale(locale);
const messages = await getMessages(locale);
return (
<html lang={locale}>
<body>
<NextIntlClientProvider locale={locale} messages={messages}>
{children}
</NextIntlClientProvider>
</body>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify({
"@context": "https://schema.org",
"@type": "Corporation",
name: "Arka",
url: "https://arka.la",
logo: "https://avatars.githubusercontent.com/u/152537545?s=200&v=4",
sameAs: [
"https://arka.la",
"https://www.linkedin.com/company/arkalab",
"https://github.com/arkalab",
],
}),
}}
/>
</html>
);
}
20 changes: 9 additions & 11 deletions app/[locale]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
// 'use client'
import { useTranslations } from 'next-intl'
import { unstable_setRequestLocale } from 'next-intl/server';

import Hero from '../../src/components/Hero'
import About from '../../src/components/About'
import Team from '../../src/components/Team'
import Partners from '../../src/components/Partners'
import Projects from '../../src/components/Projects'
import MainContent from '../../src/components/MainContent'
import Footer from "../../src/components/Footer"
import Link from 'next/link'
import { unstable_setRequestLocale } from "next-intl/server";

import Hero from "../../src/components/Hero";
import About from "../../src/components/About";
import Team from "../../src/components/Team";
import Partners from "../../src/components/Partners";
import Projects from "../../src/components/Projects";
import MainContent from "../../src/components/MainContent";
import Footer from "../../src/components/Footer";
import Link from "next/link";

export default function HomePage({ params: { locale } }) {
unstable_setRequestLocale(locale);
Expand Down
8 changes: 5 additions & 3 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
@tailwind components;
@tailwind utilities;

:root {}
:root {
}

body {}
body {
}

@font-face {
font-family: "Jost";
Expand Down Expand Up @@ -32,4 +34,4 @@ body {}
src: url("../support_files/fonts/Jost-Bold.ttf");
font-weight: 700;
font-style: bold;
}
}
6 changes: 2 additions & 4 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { ReactNode } from 'react';

import { ReactNode } from "react";

type Props = {
children: ReactNode;
};


export default function RootLayout({ children }: Props) {
return children;
}
}
7 changes: 3 additions & 4 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
'use client'
"use client";

import { redirect } from 'next/navigation';
import { redirect } from "next/navigation";

export default function RootPage() {
redirect('/en');
redirect("/en");
}

4 changes: 4 additions & 0 deletions app/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
User-agent: *
Allow: /
Disallow:
Sitemap: https://arka.la/sitemap.xml
16 changes: 16 additions & 0 deletions app/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://arka.la</loc>
<xhtml:link
rel="alternate"
hreflang="en"
href="https://arka.la/en"/>
<xhtml:link
rel="alternate"
hreflang="pt"
href="https://arka.la/pt"/>
<lastmod>2024-06-20T15:02:24.021Z</lastmod>
<changefreq>monthly</changefreq>
<priority>1</priority>
</url>
</urlset>
Loading

0 comments on commit b64233a

Please sign in to comment.