GithubHelp home page GithubHelp logo

Comments (7)

stancl avatar stancl commented on July 1, 2024

Seems like @seo() uses seo()->set(), and Flipp needs to be used via seo()->flipp(). It then calls set() for 'image':

return $this->set('image', "https://s.useflipp.com/{$template}.png?s={$signature}&v={$query}");

from laravel-seo.

tpetry avatar tpetry commented on July 1, 2024

Sure, but flipp() requires 2 parameters, how to do that with the @seo array parameter?

from laravel-seo.

stancl avatar stancl commented on July 1, 2024

Ah hmm, seems like @seo uses flipp() correctly, it doesn't call set():

BladeHelper::directive('seo', function (...$args) {
// Flipp supports more arguments
if ($args[0] === 'flipp') {
array_shift($args);
return seo()->flipp(...$args);
}

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().

from laravel-seo.

tpetry avatar tpetry commented on July 1, 2024

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.

from laravel-seo.

stancl avatar stancl commented on July 1, 2024

Ahh I see. Yeah hmm so:

  • array syntax (@seo([...])) is used for setting values rather than outputting stuff
  • arrays get passed to set()

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()?

from laravel-seo.

tpetry avatar tpetry commented on July 1, 2024

That's a possible approach, but the same for previewify.

from laravel-seo.

stancl avatar stancl commented on July 1, 2024

Perhaps your PR could check for the presence of flipp and previewify in this array ($args[0]) too?

// An array means we don't return anything, e.g. `@seo(['title' => 'foo'])
if (is_array($args[0])) {
seo($args[0]);
return null;
}

from laravel-seo.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.