page.tsx 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import Icon from '@/components/Icon';
  2. import { iconsUrl, blogEnabled } from '@/config/site';
  3. import Link from 'components/Link';
  4. import { allPosts } from 'contentlayer/generated';
  5. import { format } from 'date-fns';
  6. import { notFound } from 'next/navigation';
  7. export const metadata = {
  8. title: 'Blog',
  9. description: 'Stay in the loop with all things Tabler. We provide regular updates on new features, changelogs, and news, ensuring you never miss any of our software developments.',
  10. };
  11. export default async function BlogPage() {
  12. if(! blogEnabled) {
  13. notFound();
  14. }
  15. return (
  16. <>
  17. <section className="section">
  18. <div className="page-header">
  19. <h2 className="page-title page-title-lg">Blog</h2>
  20. <p className="page-description">
  21. Stay in the loop with all things <Link href="/">Tabler</Link> and <a href={iconsUrl}>Tabler Icons</a>. Regular updates on new features, changelogs, and news, ensuring you never miss any of our software developments.
  22. </p>
  23. </div>
  24. <div className="container">
  25. <div className="row justify-center">
  26. <div className="col-slim">
  27. <div className="divider-y-8">
  28. {allPosts.map((post, i) => (
  29. <div className="" key={post.slug} itemScope={true} itemType="https://schema.org/NewsArticle">
  30. {post.image && (
  31. <Link href={post.slug} className="d-block mb-4">
  32. <div className="outline-light rounded lh-1">
  33. <img src={`/img/blog/${post.image}`} width={660} height={361} className="rounded" alt={post.title} itemProp="image" />
  34. </div>
  35. </Link>
  36. )}
  37. <div>
  38. {post.title && (
  39. <h2>
  40. <meta itemProp="headline" content={post?.title} />
  41. <meta itemProp="url" content={post.slug} />
  42. <Link href={post.slug}>{post?.title}</Link>
  43. </h2>
  44. )}
  45. <div className="markdown text-muted">
  46. <p itemProp="description">{post.description}</p>
  47. </div>
  48. </div>
  49. <div className="mt-4">
  50. <div className="row">
  51. <div className="col">
  52. <meta itemProp="datePublished" content={format(new Date(post.date), 'yyyy-MM-dd')} />
  53. <div className="text-muted">{format(new Date(post.date), 'MMM d, Y')}</div>
  54. </div>
  55. <div className="col text-right">
  56. <Link href={post.slug} aria-label={`Read more about "${post.title}"`}>
  57. Read more <Icon name="arrow-right" />
  58. </Link>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. ))}
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. </section>
  69. <section className="section section-light">
  70. <div className="container">
  71. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis quibusdam quos est repellat rerum molestias, autem ullam, exercitationem magni non eos sunt, voluptates laboriosam dignissimos mollitia tempora ipsum illo
  72. adipisci.
  73. </div>
  74. </section>
  75. </>
  76. );
  77. }