exodusanto / laravel-ssr

Vue Server Side Rendering with Laravel + Node
20 stars 3 forks source link

Where Can i Declare All my Meta Tags? #2

Closed codeitlikemiley closed 6 years ago

codeitlikemiley commented 6 years ago

Hope You Can Add A guide Where To Put Meta Tags ive check the code renderer.js

const DEFAULT_APP_HTML = '{{ APP }}'
const DEFAULT_TITLE_HTML = '{{ _VueSSR_Title }}'
const DEFAULT_KEYWORDS_HTML = '{{ _VueSSR_Keywords }}'
const DEFAULT_DESCRIPTION_HTML = '{{ _VueSSR_Description }}'

const DEFAULT_HEAD_DATA = {
    baseTitle: 'VueSSR',
    baseKeywords: ',VueSSR',
    baseDescription: 'VueSSR',
    title: '',
    description: '',
    keywords: ''
}

On the resources/assets/views/server/app.blade.php I tried adding the following

<!doctype html>
<html lang="{{ app()->getLocale() }}">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>@{{ _VueSSR_Title }}</title>
        @{{ _VueSSR_Keywords }}
        @{{ _VueSSR_Description }}
    </head>
    <body>
        @{{ APP }}

        <script src="{{ mix('/js/main.js') }}"></script>
    </body>
</html>

but yield same result...

on the HTML , the title stay the same , meta tags all same...

Do i need to Use Vue Head or Vue Meta here to Achieve this? Im kinda clueless how you implement SEO here ... Looking forward for you reply

exodusanto commented 6 years ago

@codeitlikemiley, for meta i suggest you to use blade declaration... do you need Vue for text?

codeitlikemiley commented 6 years ago

SEO meta can be place if the app is Multi Page App, like i did in my other app that uses phpv8 js, but here I think its best to put on the router.meta , Anyway how would you approach this, can you give me your own solution thanks