How to get page title in Nuxt 3?
I am struggling to find a way to get page title in Nuxt 3 and reuse it in layout. I am pretty sure there is a way to do it through some meta object but I just can not find it. I tried to do it through route meta /layouts/default.vue <template> <h1> {{ route.meta.title }} </h1> </template> <script setup> const route = useRoute(); </script> But now when I have to set title I need to do it twice so this method works /pages/catalog.vue <script setup> definePageMeta({ title: 'Catalog Page', }); useHead({ title: 'Catalog Page', }); </script> Seems realy hacky so I open to ideas here
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.