inertiajs / inertia

Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.
https://inertiajs.com
MIT License
6.56k stars 435 forks source link

Unable to add <meta description> tag to Head component #1818

Closed eduardor2k closed 8 months ago

eduardor2k commented 8 months ago

Version:

Describe the problem:

When I add anything to the Head component, only the title is added to :

https://inertiajs.com/title-and-meta

From the docs, it should work out of the box, but I'm only getting the title

Steps to reproduce:

<Head>
    <title>MyTitle</title>
    <meta head-key="description" name="description" content="My Description" />
</Head>

Only the title will be added to head

Thanks for helping!

reinink commented 8 months ago

Hey! I just gave this a try in a local Vue 3 project and it worked without any issues. I tried putting this in a Head in both a page component and a layout component.

image

Here's my page component:

<script lang="ts">
import Layout from '../Components/Layout.vue'
export default { layout: Layout }
</script>

<script setup lang="ts">
import { Head } from '@inertiajs/vue3'
</script>

<template>
  <Head title="Article">
    <meta head-key="description" name="description" content="My Description" />
  </Head>
  <h1 class="text-3xl">Article</h1>
  <article class="max-w-3xl">
    <p class="my-6">
      Sunt culpa sit sunt enim aliquip. Esse ea ea quis voluptate. Enim consectetur aliqua ex ex magna cupidatat id
      minim sit elit. Amet pariatur occaecat pariatur duis eiusmod dolore magna. Et commodo cupidatat in commodo elit
      cupidatat minim qui id non enim ad. Culpa aliquip ad Lorem sit consectetur ullamco culpa duis nisi et fugiat
      mollit eiusmod. Laboris voluptate veniam consequat proident in nulla irure velit.
    </p>
  </article>
</template>

Keep in mind that this will only appear client-side unless you're running an SSR server.

Going to close this one for now as I can't reproduce this, but if you want to provide a minimal reproduction as a Git repo I'd be happy to have another look 👍

eduardor2k commented 8 months ago

Thanks for replying, will test this in a clean laravel + inertiajs installation, my codebase was a Laravel 7 app that has been updated, maybe I missed something

eduardor2k commented 8 months ago

Just tested, my issue is as you said, I need to have SSR running, in my app it's broke, will solve that now, tested in a brand new install and everything works

Thanks!