PHPackages                             ycs77/inertia-laravel-ssr-head - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. ycs77/inertia-laravel-ssr-head

ActiveLibrary[Templating &amp; Views](/categories/templating)

ycs77/inertia-laravel-ssr-head
==============================

Simple SSR Head for Inertia Laravel

v2.0.0(1y ago)3211.5k↓31.6%1MITPHPPHP &gt;=8.2CI passing

Since Oct 15Pushed 1y ago3 watchersCompare

[ Source](https://github.com/ycs77/inertia-laravel-ssr-head)[ Packagist](https://packagist.org/packages/ycs77/inertia-laravel-ssr-head)[ Docs](https://github.com/ycs77/inertia-laravel-ssr-head)[ RSS](/packages/ycs77-inertia-laravel-ssr-head/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (20)Used By (0)

Inertia.js Laravel SSR Head
===========================

[](#inertiajs-laravel-ssr-head)

[![Latest Version on Packagist](https://camo.githubusercontent.com/3a6937a5e19d9cc666772608fb77f5527dd208cfa140bd393ef1b0eb0afce0cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79637337372f696e65727469612d6c61726176656c2d7373722d686561643f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ycs77/inertia-laravel-ssr-head)[![Software License](https://camo.githubusercontent.com/c090e080484e2a2bc766446291d04437db823929042bf614b26a1643660ddf6f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e3f7374796c653d666c61742d737175617265)](LICENSE.md)[![GitHub Tests Action Status](https://camo.githubusercontent.com/c1e35890438bd4b8f136be5f0f19498498e62a0ae57ad700dce3d9cf16759667/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f79637337372f696e65727469612d6c61726176656c2d7373722d686561642f74657374732e796d6c3f6272616e63683d322e78266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/ycs77/inertia-laravel-ssr-head/actions/workflows/tests.yml?query=branch%3A2.x)[![Style CI Build Status](https://camo.githubusercontent.com/d1b40e908299bf397bb806d717b40ef0f323d1397390c77f22f2db6873a5a1b1/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3431373537313531392f736869656c643f7374796c653d666c61742d737175617265)](https://github.styleci.io/repos/417571519)[![Total Downloads](https://camo.githubusercontent.com/fa2690bbe61704d593aef77f39b059fad68d16202b78d7271ad4160c7c308b7b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f79637337372f696e65727469612d6c61726176656c2d7373722d686561643f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ycs77/inertia-laravel-ssr-head)

English | [繁體中文](README-zh-TW.md)

Simple SSR Head for Inertia Laravel

- 😎 Solved the Open Graph Meta crawling problem in Inertia.js x Laravel app
- ❌ No Headless Chrome, Node.js, or PHP V8 Extension
- ✨ Auto-update Inertia page title

Inspired by [Root template data of Inertia.js docs](https://inertiajs.com/responses#root-template-data).

### **NOT a full SSR solution!! It doesn't solve the SEO problem!**

[](#not-a-full-ssr-solution-it-doesnt-solve-the-seo-problem)

Because I made this package to make it easier for the bot to crawl Open Graph Meta on Inertia.js App **without installing** (or can't installing) Headless Chrome, Node.js, or PHP V8 Extension. This is applicable in situations where you are not familiar with how to install the above packages on the server, or the server does not support them (e.g. shared hosting).

If you need a full SSR solution, please use [Inertia.js Official Server-side Rendering](https://inertiajs.com/server-side-rendering).

Supported Versions
------------------

[](#supported-versions)

VersionLaravel VersionPHP Version1.x&gt;=7.0&gt;=7.32.x&gt;=11.0&gt;=8.2Installation
------------

[](#installation)

Install the package via composer:

```
composer require ycs77/inertia-laravel-ssr-head
```

Replace `` to `@inertiaHead` directive:

```

-   {{ config('app.name') }}
+   @inertiaHead

    @inertia

```

### Install client plugin

[](#install-client-plugin)

And install the client npm package:

```
npm install inertia-title
// or
yarn add inertia-title
```

The package just auto-updates the client `` tag.

Add plugin for Vue 2 in `resources/js/app.js`:

```
...
+import InertiaTitle from 'inertia-title/vue2'

+Vue.use(InertiaTitle)

createInertiaApp({
  ...
})
```

Use in Vue 3 in `resources/js/app.js`:

```
...
+import InertiaTitle from 'inertia-title/vue3'

createInertiaApp({
  ...
  setup({ el, App, props, plugin }) {
    createApp({ render: () => h(App, props) })
      .use(plugin)
+     .use(InertiaTitle)
      .mount(el)
  },
})
```

Use in React or other client-side frameworks:

```
...
+import { inertiaTitle } from 'inertia-title'

+inertiaTitle()
```

Config
------

[](#config)

Publish the config file with:

```
php artisan vendor:publish --tag="inertia-ssr-head-config"
```

You can set the twitter site username or many in config `inertia-ssr-head.php`:

```
