Git Product home page Git Product logo

Comments (6)

jesseleite avatar jesseleite commented on August 22, 2024 2

This is a good feature request. I created a more concise FR issue here, but feel free to use the above-mentioned workarounds until we have time to properly implement this 👍

from seo-pro.

jpmaga avatar jpmaga commented on August 22, 2024 1

What would be $this and $this->page in the given example?

In the first code block $this->page is the entry instance. ($this->page = \Statamic\Facades\Entry::find("[id here]")). I use it inside a class, so I just copied and pasted it here, so $this is not really relevant for the example, just pass the instance as an augmented collection.

In the second code block, I suppose you are referencing to the method $this->getAugmentedSectionDefaults, that comes from the trait GetsSectionDefaults.

from seo-pro.

jesseleite avatar jesseleite commented on August 22, 2024 1

What would be $this and $this->page in the given example?

A 'page' in SEO Pro, is a collection entry or a taxonomy term, both of which can store seo data.

from seo-pro.

jpmaga avatar jpmaga commented on August 22, 2024

Came here looking for the same. This used to work:

$tags = new SeoProTags();
$tags->setContext($this->page);
return $tags->metaData();

But yesterday updated to the latest version and it doesn't seem to work anymore, just returns the entry provided as $this->page.

Haven't had the time to look much into it, and probably will not during the week, but if I do I'll let you know.

from seo-pro.

jpmaga avatar jpmaga commented on August 22, 2024

Turns out I needed to fix this sooner than expected. 😅

So, in my case the fix was just to wrap the entry like so:

$tags = new SeoProTags();
$tags->setContext($this->page->toAugmentedCollection());
return $tags->metaData();

On a quick inspection it doesn't seem to differ much from the previous function, but you could also do something like:

use Statamic\SeoPro\Cascade;
use Statamic\SeoPro\GetsSectionDefaults;
use Statamic\SeoPro\SiteDefaults;


class SEO {
	use GetsSectionDefaults;

	public funtion get($page) {
		return (new Cascade())
			->with(SiteDefaults::load()->augmented())
			->with($this->getAugmentedSectionDefaults($page))
			->with($page->augmentedValue('seo')->value() ?? [])
			->withCurrent($page)
			->get();
    }
}

from seo-pro.

reppair avatar reppair commented on August 22, 2024

What would be $this and $this->page in the given example?

from seo-pro.

Related Issues (20)

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.