Search code examples
laravelvue.jsvuejs3inertiajs

How to set and change ( title of page ) in inertiajs and vue3


I'm using vue3 and inertiaJs with Laravel8

I want to change the (TITLE of page) if I change the page

I checked in Inertia documentation this code but it doesn't work with me and the title of the page doesn't change I installed vue-meta

  metaInfo() {
     return() {
         title: “Home Page”,
     }
  }

Solution

  • As per v0.4.0 of Inertia, they now bundle their own inertia-head component you can use to add meta tags and update the title. There is no longer a need for vue-meta.

    Simply add the following directly to your page components:

    <inertia-head>
      <title>Your page title</title>
      <meta name="description" content="Your page description">
    </inertia-head>
    

    You can find more information in the change logs of v0.4.0.