Skip to content

Commit 2825ea8

Browse files
committed
refactor(blog): remove title placeholders from files and update layout with dynamic title
1 parent 97a865e commit 2825ea8

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

app/blogs/hello/page.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@ export const metadata = generateMetadata({
66
date: '2024-05-11'
77
});
88

9-
# {metadata.title}
10-
119
Hello, world! This is my first blog post. I'm excited to share my thoughts with you. I don't have much time to write, but I'll try to make it worth your while. Check back soon for more updates!

app/blogs/layout.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
'use client';
22

33
import cn from '@/utils/cn';
4-
import Link from 'next/link';
4+
import { Link } from 'next-view-transitions';
55
import { useRouter } from 'next/navigation';
6-
import { useEffect } from 'react';
6+
import { useEffect, useState } from 'react';
77

88
export default function BlogLayout({ children }: Readonly<{ children: React.ReactNode }>) {
99
const router = useRouter();
1010

11+
const [title, setTitle] = useState(document.title);
12+
1113
useEffect(() => {
1214
const headings = document.querySelectorAll('h2, h3, h4, h5, h6');
1315

@@ -45,6 +47,8 @@ export default function BlogLayout({ children }: Readonly<{ children: React.Reac
4547
});
4648
}
4749
}
50+
51+
setTitle(document.title);
4852
}, []);
4953

5054
return (
@@ -54,11 +58,11 @@ export default function BlogLayout({ children }: Readonly<{ children: React.Reac
5458
href='/'
5559
>
5660
<h1 className='font-bricolageGrotesque font-bold'>
57-
Gökhan Bulut
61+
{title.split(' - ').shift()}
5862
</h1>
5963

60-
<span className='text-sm text-secondary'>
61-
Full-stack Developer
64+
<span className='text-sm text-tertiary'>
65+
Gökhan Bulut
6266
</span>
6367
</Link>
6468

app/blogs/using-lantern-rest-to-display-your-discord-presence/page.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ export const metadata = generateMetadata({
88
date: '2024-12-01'
99
});
1010

11-
# {metadata.title}
12-
1311
Ever wanted to showcase your Discord status, current gaming session, or Spotify tracks on your personal website? Enter Lantern, a powerful service that makes it incredibly easy to broadcast your Discord presence in real-time. In this post, we'll explore how Lantern works and how you can integrate it into your projects.
1412

1513
## What is Lantern?

0 commit comments

Comments
 (0)