From the course: Master Next.js: Elaborate Hands-On Web Development, React Basics, Advanced Next.js, and Deployment

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Scripts and header data and props with Next.js

Scripts and header data and props with Next.js

All right, so enough looking at my cool self with pictures. Let's talk about metadata. What if we wanted to change the metadata of a page, like the title of an HTML tag? So title is part of the head HTML tag, but you have to think about this. So let's go back into the pages. We can leave my picture for now, let's go back into index. Let's find out that line with our header here. Now we have a header and then we put a title. Title is a part of this head tag, But notice how head is uppercase and title is lowercase. That's because head is a React component that's built in inherently to Next.js. And notice how that's imported here. So I don't think we've done that yet in our first post page. So let's go back to our first post and let's import the next head. So we're going to import head from next-head. and we're going to now let's update this first post which is an h1 to actually be a header so we're going to wrap it around the head voila now we've wrapped it around and instead of using…

Contents