Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
feat: sitemap + seo
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgfr committed Feb 11, 2022
1 parent 980ee03 commit f6d7b26
Show file tree
Hide file tree
Showing 26 changed files with 313 additions and 187 deletions.
6 changes: 6 additions & 0 deletions next-sitemap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('next-sitemap').IConfig} */

module.exports = {
siteUrl: process.env.SITE_URL || "https://template.fabrique.social.gouv.fr/",
generateRobotsTxt: true,
};
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"postbuild": "next-sitemap",
"start": "next start",
"lint": "next lint",
"export": "next export",
Expand All @@ -12,6 +13,7 @@
"dependencies": {
"@dataesr/react-dsfr": "^1.0.2",
"next": "12.0.9",
"next-seo": "^5.1.0",
"react": "17.0.2",
"react-dom": "17.0.2"
},
Expand All @@ -20,6 +22,7 @@
"@types/react": "17.0.38",
"eslint": "8.7.0",
"eslint-config-next": "12.0.9",
"next-sitemap": "^2.1.14",
"typescript": "4.5.5"
},
"version": "1.2.1"
Expand Down
24 changes: 14 additions & 10 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import type { NextPage } from "next";
import Head from "next/head";
import { Footer, Header } from "@components";
import { NextSeo } from "next-seo";

const Home: NextPage = () => {
return (
<div style={{ height: "800px" }}>
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
</Head>
yooooo
</div>
<>
<NextSeo
title="Template"
description="Template de la fabrique des ministères sociaux."
additionalLinkTags={[
{
rel: "icon",
href: "/favicon.ico",
},
]}
/>
<div style={{ height: "800px" }}>yooooo</div>
</>
);
};

Expand Down
File renamed without changes
Binary file modified public/favicon.ico
Binary file not shown.
10 changes: 10 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# *
User-agent: *
Allow: /

# Host
Host: https://template.fabrique.social.gouv.fr/

# Sitemaps
Sitemap: https://template.fabrique.social.gouv.fr/sitemap.xml
Sitemap: https://template.fabrique.social.gouv.fr/sitemap-0.xml
4 changes: 4 additions & 0 deletions public/sitemap-0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://template.fabrique.social.gouv.fr</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2022-02-11T12:02:37.947Z</lastmod></url>
</urlset>
4 changes: 4 additions & 0 deletions public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>https://template.fabrique.social.gouv.fr/sitemap-0.xml</loc></sitemap>
</sitemapindex>
4 changes: 0 additions & 4 deletions public/vercel.svg

This file was deleted.

4 changes: 2 additions & 2 deletions src/components/footer/body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
Link,
FooterOperator,
} from "@dataesr/react-dsfr";
import { BodySectionProps } from "./type";
import { FooterBodySectionProps } from "./type";

export const Body = (props: BodySectionProps): JSX.Element => (
export const Body = (props: FooterBodySectionProps): JSX.Element => (
<FooterBody description={props.description}>
<Logo>{props.ministryName}</Logo>
{props.image && (
Expand Down
4 changes: 2 additions & 2 deletions src/components/footer/bottom.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FooterBottom, FooterCopy, FooterLink } from "@dataesr/react-dsfr";
import { BottomSectionProps } from "./type";
import { FooterBottomSectionProps } from "./type";

export const Bottom = (props: BottomSectionProps): JSX.Element => (
export const Bottom = (props: FooterBottomSectionProps): JSX.Element => (
<FooterBottom>
{props.links.map((link, index) => (
<FooterLink key={`${index}-${link.title}`} href={link.href}>
Expand Down
17 changes: 1 addition & 16 deletions src/components/footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
import {
Footer,
FooterTopCategory,
FooterLink,
FooterTop,
FooterBody,
FooterOperator,
FooterBodyItem,
FooterPartners,
FooterPartnersTitle,
FooterPartnersLogo,
FooterBottom,
FooterCopy,
Link,
Logo,
} from "@dataesr/react-dsfr";
import { Footer } from "@dataesr/react-dsfr";
import { Body } from "./body";
import { Bottom } from "./bottom";
import { Partners } from "./partner";
Expand Down
4 changes: 2 additions & 2 deletions src/components/footer/partner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import {
FooterPartnersTitle,
FooterPartnersLogo,
} from "@dataesr/react-dsfr";
import { PartnerSectionProps } from "./type";
import { FooterPartnerSectionProps } from "./type";

export const Partners = (props: PartnerSectionProps): JSX.Element => (
export const Partners = (props: FooterPartnerSectionProps): JSX.Element => (
<FooterPartners>
<FooterPartnersTitle>{props.title}</FooterPartnersTitle>
{props.logos?.map((logo, index) => (
Expand Down
4 changes: 2 additions & 2 deletions src/components/footer/top.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FooterTop, FooterTopCategory, FooterLink } from "@dataesr/react-dsfr";
import { TopSectionProps } from "./type";
import { FooterTopSectionProps } from "./type";

export const Top = (props: TopSectionProps): JSX.Element => (
export const Top = (props: FooterTopSectionProps): JSX.Element => (
<FooterTop>
{props.links.map((item, index) => (
<FooterTopCategory key={`${index}-${item.title}`} title={item.title}>
Expand Down
16 changes: 8 additions & 8 deletions src/components/footer/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,30 @@ type Logo = Image & {
href: string;
};

export type PartnerSectionProps = {
export type FooterPartnerSectionProps = {
title: string;
logos: Array<Logo>;
};

export type BottomSectionProps = {
export type FooterBottomSectionProps = {
links: Array<Link>;
copyright: string;
};

export type TopSectionProps = {
export type FooterTopSectionProps = {
links: Array<LinksWithCategory>;
};

export type BodySectionProps = {
export type FooterBodySectionProps = {
links?: Array<Link>;
image?: Image;
ministryName: string;
description: string;
};

export type FooterProps = {
topSection?: TopSectionProps;
bodySection?: BodySectionProps;
partnerSection?: PartnerSectionProps;
bottomSection?: BottomSectionProps;
topSection?: FooterTopSectionProps;
bodySection?: FooterBodySectionProps;
partnerSection?: FooterPartnerSectionProps;
bottomSection?: FooterBottomSectionProps;
};
6 changes: 5 additions & 1 deletion src/components/header/body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ export const Body = (props: HeaderBodyProps): JSX.Element => (
<Logo splitCharacter={props.splitTitleLength ?? 10}>{props.mainTitle}</Logo>
{props.image && (
<HeaderOperator>
<img src={props.image.src} alt={props.image.alt} />
<img
src={props.image.src}
alt={props.image.alt}
style={{ height: props.image.height, width: props.image.width }}
/>
</HeaderOperator>
)}
<Service
Expand Down
4 changes: 2 additions & 2 deletions src/components/header/nav.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { HeaderNav, NavItem, NavSubItem } from "@dataesr/react-dsfr";
import { MegaNav } from "./megaNav";
import { NavProps } from "./type";
import { HeaderNavProps } from "./type";

export const Nav = (props: NavProps): JSX.Element => (
export const Nav = (props: HeaderNavProps): JSX.Element => (
<HeaderNav>
{props.items.map((item, index) => {
if ("headingLevel" in item) {
Expand Down
6 changes: 4 additions & 2 deletions src/components/header/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ type NavItem = ItemLink & { links: Array<Link> };
type Image = {
alt: string;
src: string;
height: string;
width: string;
};

type RegularNavProps = {
Expand All @@ -33,7 +35,7 @@ export type MegaNavProps = {
items: Array<NavItem>;
};

export type NavProps = {
export type HeaderNavProps = {
items: Array<RegularNavProps | MegaNavProps>;
};

Expand All @@ -47,6 +49,6 @@ export type HeaderBodyProps = {
};

export type HeaderProps = {
navSection?: NavProps;
navSection?: HeaderNavProps;
bodySection: HeaderBodyProps;
};
2 changes: 2 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export { default as Header } from "./header";
export { default as Footer } from "./footer";
export { default as Layout } from "./layout";
export * from "./header/type";
export * from "./footer/type";
Loading

0 comments on commit f6d7b26

Please sign in to comment.