Download the PHP package gwd/seo-meta-nova-field without Composer
On this page you can find all versions of the php package gwd/seo-meta-nova-field. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gwd/seo-meta-nova-field
More information about gwd/seo-meta-nova-field
Files in gwd/seo-meta-nova-field
Package seo-meta-nova-field
Short Description A Laravel Nova field which adds all SEO related meta fields to an Resource.
License MIT
Homepage https://github.com/AndreasGJ/seo-meta-field-nova
Informations about the package seo-meta-nova-field
SEO meta field nova
This custom nova field, can add SEO related fields to any Model through a morph relationship within one single trait.
How to install
To install the package run the install below:
And then run the migrations:
And then publish the configs:
How to use the field
Find the model you want to have the SEO fields on, example could be App\Models\Page
, then add the SeoMetaTrait
trait:
Then use the field in the nova resource App\Nova\Page
:
Then go to the top of your layout blade as default it's resources/views/welcome.blade.php
:
Where the @include('seo-meta::seo', ['page' => $page])
, should have the model instance with the relation to the SeoMetaTrait
trait.
If you dont have any selected model/resource on the current page, then get the given SEO data for the page like this:
Here is how the Seo::renderAttributes
static method looks like:
Setup default values for a model
If the SEO values should have the same structure every time, then you are able to set the up with the following methods in the trait:
Setup Sitemap functionality
If you want the sitemap functionality then activate the sitemap by changing the seo.sitemap_status
config to true
. Then add the models which has the SeoSitemapTrait
trait to the seo.sitemap_models
array, like this:
Add Sitemap trait to models
When you want the eloquent model to be shown in the sitemap then you need to add the SeoSitemapTrait
trait to it:
Know you should be able to go to the seo.sitemap_path
which is /sitemap
as default. Then you should get an xml in the correct sitemap structure for Google Search Console.
How does it look in Laravel Nova
If the field is shown in the index view of the Resource, then you should see a column with a dot:
In detail view you will see a text saying You need some SEO data
if no SEO is setup yet. But if you have any then, you will get the toggle button, which will show you an example how it will look like on Google and on Facebook:
In form view you should see all the SEO input fields: