You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thanks for writing this package. I'm new to Laravel and am having trouble understanding how to implement OG and Twitter cards as easily as you have the basic meta tags.
It's not clear to me how I can set a default set of OG and Twitter Card data, and how to render it or modify it.
I can see that meta_tags.php has the option of automatically including certain packages, and apparently I'm supposed to create packages in \App\Providers\MetaTagServiceProvider.php where I have
$og = newOpenGraphPackage('OG');
$og->setType('website')
->setSiteName('My Sitename')
->setTitle('I am a OG title');
When I view the pages, it doesn't have anything for open graph .. but if I modify the controller
$og = new OpenGraphPackage('og');
$og->setType('website')
->setSiteName('My Sitename')
->setTitle('My Site Title')
->setUrl(env('APP_URL'));
Meta::registerPackage($og);
Then when I view the page, I can see the OG data in the source.
My question is, what's the best way to set some defaults for the OG data, and then be able to change it when necessary? I've looked at issue #38 but, it's not clicking in my head..
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First, thanks for writing this package. I'm new to Laravel and am having trouble understanding how to implement OG and Twitter cards as easily as you have the basic meta tags.
It's not clear to me how I can set a default set of OG and Twitter Card data, and how to render it or modify it.
I can see that meta_tags.php has the option of automatically including certain packages, and apparently I'm supposed to create packages in \App\Providers\MetaTagServiceProvider.php where I have
And in config/meta_tags.php it says
When I view the pages, it doesn't have anything for open graph .. but if I modify the controller
$og = new OpenGraphPackage('og');
$og->setType('website')
->setSiteName('My Sitename')
->setTitle('My Site Title')
->setUrl(env('APP_URL'));
Then when I view the page, I can see the OG data in the source.
My question is, what's the best way to set some defaults for the OG data, and then be able to change it when necessary? I've looked at issue #38 but, it's not clicking in my head..
Beta Was this translation helpful? Give feedback.
All reactions