feat: SEO optimized

This commit is contained in:
원더 2021-01-07 23:57:38 +09:00
parent 57c9833756
commit ebae9732c3
4 changed files with 33 additions and 3 deletions

24
components/SEO.tsx Normal file
View File

@ -0,0 +1,24 @@
import Head from 'next/head'
const SEO = ({ title, description, image }:SEOProps):JSX.Element => {
return <Head>
<title>{title}</title>
{ description && <meta
name="description"
content={description}
/> }
<meta name="og:site_name" content="한국 디스코드봇 리스트" />
<meta name="og:title" content={title} />
{ description && <meta name="og:description" content={description} /> }
{ image && <meta name="og:image" content={image} /> }
</Head>
}
export default SEO
interface SEOProps {
title: string
description?: string
image?: string
}

View File

@ -43,11 +43,13 @@ export default function App({ Component, pageProps }: AppProps): JSX.Element {
<meta
name="description"
content="국내 디스코드봇들을 확인하고, 초대해보세요!"
data-react-helmet="true"
/>
<meta name="og:title" content="한국 디스코드봇 리스트" />
<meta name="og:url" content="https://koreanbots.dev" />
<meta name="og:description" content="국내 디스코드봇들을 확인하고, 초대해보세요!" />
<meta name="og:image" content="/logo.png" />
<meta charSet="utf-8" />
<link rel="shortcut icon" href="/logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#3366FF" />
</Head>
<Navbar />

View File

@ -1,4 +1,5 @@
import { NextPage, NextPageContext } from 'next'
import Head from 'next/head'
import { SnowflakeUtil } from 'discord.js'
import Day from '../../utils/Day'
import { ParsedUrlQuery } from 'querystring'
@ -12,11 +13,13 @@ import Segment from '../../components/Segment'
import { Bot, User } from '../../types'
import Fetch from '../../utils/Fetch'
import NotFound from '../404'
import SEO from '../../components/SEO'
const Bots:NextPage<BotsProps> = ({ data, date }) => {
console.log(data)
if(!data.id) return <NotFound />
return <Container paddingTop className='py-10'>
<SEO title={data.name} description={data.intro} image={data.avatar ? `https://cdn.discordapp.com/avatars/${data.id}/${data.avatar}.png?size=1024` : `https://cdn.discordapp.com/embed/avatars/${Number(data.tag) % 5}.png?size=1024`} />
<div className='lg:flex'>
<div className='w-full lg:w-1/3 text-center'>
<DiscordImage userID={data.id} avatarHash={data.avatar} tag={data.tag} className='w-full'/>
@ -25,7 +28,7 @@ const Bots:NextPage<BotsProps> = ({ data, date }) => {
<div className='flex'>
<h1 className='text-4xl font-bold mb-2'>{data.name} {data.trusted && <span className='text-koreanbots-blue text-3xl'><i className='fas fa-award' /></span>}</h1>
</div>
<p className='text-base text-gray-800 dark:text-gray-300'>{data.desc}</p>
<p className='text-base text-gray-800 dark:text-gray-300'>{data.intro}</p>
</div>
</div>
<Divider className='px-5' />

1
public/robots.txt Normal file
View File

@ -0,0 +1 @@
User-agent: *