Comments (6)
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.
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.
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.
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.
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.
What would be $this
and $this->page
in the given example?
from seo-pro.
Related Issues (20)
- Site and Alternate Locales broken in v5.2 HOT 2
- Error in Documentation or Bug with Antlers Code as Description HOT 8
- SiteDefaults are not localizable HOT 4
- Add missing markup to fix Google Search Console Error HOT 3
- Feature request: more control over sitemap content HOT 1
- Support paginated urls in sitemap.xml
- Front end cookies HOT 1
- Link rel='alternate' tags hreflang does not include language and locale HOT 7
- Social image from an Assets field (with multiple images) creating output of multiple social images HOT 1
- What is the correct syntax for using "From Field"?
- Improve support for custom route/controller page implementations HOT 1
- I get a "Vite manifest not found" error after installing the addon HOT 1
- What is the latest version that supports Statamic 3? HOT 2
- Wrong display in live preview
- Error ·Closure (Chunk.php:51) HOT 2
- Multisite Sitemap Support in SEO Pro HOT 1
- SEO Report shows duplicate title for pages in Multisite setup
- «Read only» visibility for Seo Pro fieldtype is not working / a.k.a hide Seo Pro fieldtype for editors
- False warning: pages with duplicate titles HOT 8
- Use same value for og:title as <title> tag
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from seo-pro.