diff --git a/ui/app/robots.ts b/ui/app/robots.ts new file mode 100644 index 0000000000..363ebd429f --- /dev/null +++ b/ui/app/robots.ts @@ -0,0 +1,30 @@ +import type { MetadataRoute } from "next" + +import { publicConfig } from "../config.public" + +const getRobotRules = () => { + const { env } = publicConfig + switch (env) { + case "production": + return { + rules: { + userAgent: "*", + disallow: ["/test-widget", "/recherche-apprentissage", "/recherche-apprentissage-formation", "/recherche-emploi"], + }, + sitemap: "https://labonnealternance.apprentissage.beta.gouv.fr/sitemap.xml", + } + + default: + return { + rules: { + userAgent: "*", + disallow: "/", + }, + sitemap: "", + } + } +} + +export default function Robots(): MetadataRoute.Robots { + return getRobotRules() +} diff --git a/ui/components/footer.tsx b/ui/components/footer.tsx index 5c212af55f..a9c8160b17 100644 --- a/ui/components/footer.tsx +++ b/ui/components/footer.tsx @@ -1,6 +1,8 @@ import { ExternalLinkIcon } from "@chakra-ui/icons" import { Box, Container, Divider, Flex, Grid, GridItem, Image, Link, ListItem, UnorderedList } from "@chakra-ui/react" import NextLink from "next/link" +import { useRouter } from "next/router" +import { useEffect, useState } from "react" import { publicConfig } from "../config.public" @@ -24,7 +26,19 @@ const lastLink = { paddingLeft: { base: 0, lg: 4 }, } -const Footer = ({ ressources = "" }: { ressources?: string }) => { +const Footer = () => { + const { pathname } = useRouter() + const [ressource, setRessource] = useState() + + useEffect(() => { + if (pathname === "/acces-recruteur") { + setRessource("recruter") + } + if (pathname === "/organisme-de-formation") { + setRessource("cfa") + } + }, []) + return ( @@ -116,7 +130,7 @@ const Footer = ({ ressources = "" }: { ressources?: string }) => { - + Ressources diff --git a/ui/next.config.js b/ui/next.config.js index e04fd0a9cc..491f3408b7 100644 --- a/ui/next.config.js +++ b/ui/next.config.js @@ -78,35 +78,15 @@ const nextConfig = withImages({ hideSourceMaps: false, widenClientFileUpload: true, }, - async rewrites() { - return [ - { - source: "/robots.txt", - destination: "/api/robots", - }, - ] - }, async headers() { return [ { source: "/:path*", headers: [ - { - key: "X-Content-Type-Options", - value: "nosniff", - }, { key: "Content-Security-Policy", value: inline(contentSecurityPolicy + " frame-ancestors 'none';"), }, - { - key: "Referrer-Policy", - value: "unsafe-url", - }, - { - key: "Strict-Transport-Security", - value: "max-age=31536000; includeSubDomains", - }, ], }, { diff --git a/ui/pages/acces-recruteur.tsx b/ui/pages/acces-recruteur.tsx index eb90ef5a20..4043622c3d 100644 --- a/ui/pages/acces-recruteur.tsx +++ b/ui/pages/acces-recruteur.tsx @@ -61,7 +61,7 @@ const AccesRecruteur = () => (   -