feat: refactor DUMMY to APP and add meta title configuration for improved SEO
This commit is contained in:
parent
25ad73aa9d
commit
d9070b1b49
@ -1,6 +1,21 @@
|
||||
export const DUMMY = {
|
||||
export const APP = {
|
||||
title: 'React Router',
|
||||
description:
|
||||
'Bonus judex secundum aequum et\n bonum judicat et aequitatem stricto juri praefert',
|
||||
logo: '/images/logo.svg',
|
||||
}
|
||||
|
||||
export const META_TITLE_CONFIG = [
|
||||
{
|
||||
path: '/news',
|
||||
title: 'Home',
|
||||
},
|
||||
{
|
||||
path: '/auth/login',
|
||||
title: 'Login',
|
||||
},
|
||||
{
|
||||
path: '/auth/register',
|
||||
title: 'Register',
|
||||
},
|
||||
]
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
import { Link } from 'react-router'
|
||||
|
||||
import { DUMMY } from '~/data/dummy'
|
||||
import { COPYRIGHT_MENU, FOOTER_MENU } from '~/data/menu'
|
||||
import { APP } from '~/data/dummy'
|
||||
|
||||
import { COPYRIGHT_MENU, FOOTER_MENU } from './menu'
|
||||
|
||||
export const FooterLinks = () => {
|
||||
return (
|
||||
@ -36,7 +37,7 @@ export const FooterLinks = () => {
|
||||
</div>
|
||||
<div className="flex justify-between border-t border-white pt-8 text-sm">
|
||||
<div>
|
||||
{new Date().getFullYear()} {DUMMY.title}. All rights reserved.
|
||||
{new Date().getFullYear()} {APP.title}. All rights reserved.
|
||||
</div>
|
||||
<div className="flex gap-6">
|
||||
{COPYRIGHT_MENU.map(({ url, title }, index) => (
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Link } from 'react-router'
|
||||
|
||||
import { Button } from '~/components/ui/button'
|
||||
import { DUMMY } from '~/data/dummy'
|
||||
import { APP } from '~/data/dummy'
|
||||
|
||||
export const FooterNewsletter = () => {
|
||||
return (
|
||||
@ -12,8 +12,8 @@ export const FooterNewsletter = () => {
|
||||
className="h-full"
|
||||
>
|
||||
<img
|
||||
src={DUMMY.logo}
|
||||
alt={DUMMY.title}
|
||||
src={APP.logo}
|
||||
alt={APP.title}
|
||||
className="h-full w-auto"
|
||||
/>
|
||||
</Link>
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import { Link } from 'react-router'
|
||||
|
||||
import { MENU } from '~/data/menu'
|
||||
|
||||
import { HeaderSearch } from './header-search'
|
||||
import { MENU } from './menu'
|
||||
|
||||
export const HeaderMenu = () => {
|
||||
return (
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { Link } from 'react-router'
|
||||
|
||||
import { Button } from '~/components/ui/button'
|
||||
import { DUMMY } from '~/data/dummy'
|
||||
import { APP } from '~/data/dummy'
|
||||
|
||||
export const HeaderTop = () => {
|
||||
return (
|
||||
@ -11,13 +11,13 @@ export const HeaderTop = () => {
|
||||
className="h-full py-[5px]"
|
||||
>
|
||||
<img
|
||||
src={DUMMY.logo}
|
||||
alt={DUMMY.title}
|
||||
src={APP.logo}
|
||||
alt={APP.title}
|
||||
className="h-full w-auto"
|
||||
/>
|
||||
</Link>
|
||||
<div className="flex h-full items-center py-1.5 font-light whitespace-pre-line">
|
||||
{DUMMY.description}
|
||||
{APP.description}
|
||||
</div>
|
||||
<div className="flex items-center gap-[15px]">
|
||||
<Button>About Us</Button>
|
||||
|
||||
16
app/root.tsx
16
app/root.tsx
@ -9,6 +9,7 @@ import {
|
||||
|
||||
import type { Route } from './+types/root'
|
||||
import './app.css'
|
||||
import { APP, META_TITLE_CONFIG } from './data/dummy'
|
||||
|
||||
export const links: Route.LinksFunction = () => [
|
||||
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
|
||||
@ -23,6 +24,21 @@ export const links: Route.LinksFunction = () => [
|
||||
},
|
||||
]
|
||||
|
||||
export const meta = ({ location }: Route.MetaArgs) => {
|
||||
const { pathname } = location
|
||||
const pageTitle = META_TITLE_CONFIG.find(
|
||||
(meta) => meta.path === pathname,
|
||||
)?.title
|
||||
const metaTitle = APP.title
|
||||
const title = `${pageTitle ? `${pageTitle} - ` : ''}${metaTitle}`
|
||||
|
||||
return [
|
||||
{
|
||||
title,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
export function Layout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<html lang="en">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user