Closed tpetry closed 2 years ago
Seems like @seo()
uses seo()->set()
, and Flipp needs to be used via seo()->flipp()
. It then calls set()
for 'image'
: https://github.com/archtechx/laravel-seo/blob/754b3936d0772a1d368240271ec8532353bac1e8/src/SEOManager.php#L180
Sure, but flipp()
requires 2 parameters, how to do that with the @seo
array parameter?
Ah hmm, seems like @seo
uses flipp()
correctly, it doesn't call set()
:
https://github.com/archtechx/laravel-seo/blob/754b3936d0772a1d368240271ec8532353bac1e8/src/SEOServiceProvider.php#L34-L40
I think the right syntax is @seo('flipp', [ array data ])
. When you pass an array to @seo
, there's no first argument indicating that this is a flipp()
call, so it goes straight to set()
.
But @seo('flipp', [ array data ])
will output the image URL. I just want to define the social image on one view which is then used by the meta tags in the laout, exactly like @seo(['title' => 'Test123'])
.
To make it more clear. Here's an example:
@seo([
'title' => 'Hello World',
/* not possible */ 'flipp' => ['blog', ['headline' => 'Lorem Ipsum', 'teaser' => 'Lorem Ipsum, Lorem Ipsum']]
])
<x-layout>Some content</x-layout>
The @seo
tag seems to only support strings for values, but the flipp and previewify functions need more parameters.
Ahh I see. Yeah hmm so:
@seo([...])
) is used for setting values rather than outputting stuffset()
So the blade directive should probably check if a passed array has a flipp
key, and then call the flipp()
method and exclude it from the data passed to set()
?
That's a possible approach, but the same for previewify.
Perhaps your PR could check for the presence of flipp
and previewify
in this array ($args[0]) too?
The
@seo
blade tag can set e.g. the description like this@seo(['description' => 'foo'])
. But I didn't find any way to do the same for the social image? The following call (which I expected to work) resulted in an error: