Meta titles and desc

This commit is contained in:
2023-07-09 23:28:56 +04:00
parent 6194862e6f
commit 5acaeccb70
4 changed files with 26 additions and 9 deletions

View File

@@ -1,8 +1,9 @@
import { Link } from '@chakra-ui/next-js'
import { Box, Button, Flex, Heading, Image, List, ListIcon, ListItem, SimpleGrid, Text } from '@chakra-ui/react'
import { iso31661 } from 'iso-3166'
import Head from 'next/head'
import { FaFacebookSquare, FaLinkedin, FaTwitterSquare } from 'react-icons/fa'
import { TbWorldWww } from 'react-icons/tb'
import { iso31661 } from 'iso-3166'
export const getStaticPaths = async () => {
const url = new URL(`${process.env.NEXT_PUBLIC_DIRECTUS_API_URL}/items/vendors`)
@@ -35,12 +36,17 @@ export const getStaticProps = async ({ params: { slug } }) => {
data: [vendor],
} = await res.json()
return { props: { ...vendor, country: iso31661.find((iso) => iso.alpha3 === vendor.country)?.name || '' } }
return {
props: { vendor: { ...vendor, country: iso31661.find((iso) => iso.alpha3 === vendor.country)?.name || '' } },
}
}
export default function VendorPage(vendor) {
export default function VendorPage({ globals, vendor }) {
return (
<Box className="vendor">
<Head>
<title>{[vendor.name, globals.meta_title].join(' — ')}</title>
</Head>
<Flex justifyContent="space-between" direction={['column', 'column', 'row']}>
<Heading marginY="6">{vendor.name}</Heading>
<Image

View File

@@ -35,6 +35,7 @@ import {
Tr,
} from '@chakra-ui/react'
import { useDebouncedCallback, useLocalStorageValue } from '@react-hookz/web'
import Head from 'next/head'
import { useRouter } from 'next/router'
import { TbCheck, TbFilter, TbFilterEdit, TbLayoutGrid, TbLayoutList, TbMoodSad, TbSearch, TbX } from 'react-icons/tb'
import useSWR from 'swr'
@@ -66,7 +67,7 @@ export const getStaticProps = async () => {
return { props: { categories } }
}
export default function VendorsPage({ categories }) {
export default function VendorsPage({ globals, categories }) {
const router = useRouter()
const {
query: { page = 1, category = '', q: search = '' },
@@ -135,6 +136,9 @@ export default function VendorsPage({ categories }) {
return (
<Box className="vendors">
<Head>
<title>{['Vendors', globals.meta_title].join(' — ')}</title>
</Head>
<Flex alignItems="center" justifyContent="space-between" direction={['column', 'row']} mb="5" gap="5">
<Heading size="lg">Vendors</Heading>
<Box>{isValidating && <Spinner />}</Box>