Title.tsx 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import Head from 'next/head';
  2. import { uiUrl } from '@/config/site';
  3. import { useRouter } from 'next/router';
  4. export default function Title({ meta = {
  5. title: '',
  6. image: '',
  7. description: '',
  8. }}) {
  9. const router = useRouter(),
  10. path = router.pathname;
  11. let section = '';
  12. if (path.match(/\/docs/)) {
  13. section = 'Documentation';
  14. }
  15. const title = meta.title
  16. ? `${meta.title} - ${section ? `${section} - ` : ''}Tabler`
  17. : 'Tabler: Premium dashboard template with responsive and high quality UI';
  18. const image = `${meta.image ? meta.image : `${uiUrl}/img/tabler/og.png?2`}`;
  19. const description = meta.description
  20. ? meta.description
  21. : 'Tabler comes with tons of well-designed components and features. Start your adventure with Tabler and make your dashboard great again. For free!';
  22. const canonical = `${uiUrl}${(path === '/' ? '' : path).split('?')[0]}`;
  23. return (
  24. <Head>
  25. <link rel="canonical" href={canonical} />
  26. <title key="title">{title}</title>
  27. <meta key="og:type" property="og:type" content="website" />
  28. <meta key="og:url" property="og:url" content={canonical} />
  29. <meta key="og:title" property="og:title" content={title} />
  30. <meta key="twitter:title" name="twitter:title" content={title} />
  31. <meta key="description" name="description" content={description} />
  32. <meta key="og:description" property="og:description" content={description} />
  33. <meta key="og:image" property="og:image" content={`${image}`} />
  34. <meta key="twitter:image" name="twitter:image" content={`${image}`} />
  35. <meta key="og:image:width" property="og:image:width" content="1200" />
  36. <meta key="og:image:height" property="og:image:height" content="630" />
  37. <meta key="twitter:card" name="twitter:card" content="summary_large_image" />
  38. <meta key="twitter:site" name="twitter:site" content="@codecalm" />
  39. <meta key="twitter:creator" name="twitter:creator" content="@codecalm" />
  40. <link rel="preconnect" href="https://rsms.me/" />
  41. <link rel="preconnect" href="https://vitals.vercel-insights.com/" />
  42. <link rel="shortcut icon" href="/favicon.ico" />
  43. <link rel="icon" type="image/png" sizes="16x16" href="/favicons/favicon-16x16.png" />
  44. <link rel="icon" type="image/png" sizes="32x32" href="/favicons/favicon-32x32.png" />
  45. <link rel="icon" type="image/png" sizes="48x48" href="/favicons/favicon-48x48.png" />
  46. <link rel="manifest" href="/favicons/manifest.json" />
  47. <meta name="theme-color" content="#fff" />
  48. <meta name="application-name" content="tabler" />
  49. <link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-touch-icon-180x180.png" />
  50. <meta name="msapplication-TileColor" content="#206bc4" />
  51. <meta httpEquiv="X-UA-Compatible" content="ie=edge" />
  52. <meta httpEquiv="pragma" content="no-cache" />
  53. </Head>
  54. );
  55. }