Mikie Posted May 29, 2019 Share Posted May 29, 2019 @3fingers Having said all the above, maybe it is easiest to just disable the tag you are having trouble with and add it manually? Or for that template render out each one individually and build the image tag yourself. This is Processwire’s only issue, for every problem there are a million solutions!!!! 1 Link to comment Share on other sites More sharing options...
Wanze Posted May 29, 2019 Author Share Posted May 29, 2019 On 5/28/2019 at 11:00 AM, 3fingers said: Hi @Wanze, is it possibile to query a ProField Matrix field (an image in this particular case) as a placeholder for the og:image setting? Something like {matrixfield.imagefield} ? Right now the only images I have inside my templates come from a field of type Matrix. Any solution available? ? @3fingers Did you try if it works? I think it won't because the module currently expects an image field on the page, it cannot resolve nested fields. For text based placeholders, this should work, as the module uses ProcessWire's wirePopulateStringTags function which supports nested WireData objects. One solution would be the one mentioned by @Mikie: To populate the og image URL from your matrix field when saving the page, via hook. Another possibility is to use a hook provided by the module to modify the OG image url when being rendered, check out the following issue and the linked test cases for the hooks: https://github.com/wanze/SeoMaestro/issues/8 Cheers 1 Link to comment Share on other sites More sharing options...
Wanze Posted May 29, 2019 Author Share Posted May 29, 2019 11 hours ago, Mikie said: I came to ask a similar question, as mentioned I haven’t even tested this yet so sorry if I missed something ... if you reference a field for the description with large amounts of text does it automatically truncate the text? If not, is there a way to do this in the {field} placeholder, like {field|truncate:200} ? Would be handy. @Mikie The module does not truncate any texts, I can see this as an additional setting on field level. The truncate filter looks good, but the used function to parse the expression of ProcessWire does not support this kind of filters. Would be way easier if this could be left to a template engine ? One solution would be to use a hook to truncate the text when rendering: $wire->addHookAfter('SeoMaestro::renderSeoDataValue', function (HookEvent $event) { $group = $event->arguments(0); $name = $event->arguments(1); $value = $event->arguments(2); if ($group === 'meta' && $name === 'description') { $event->return = substr($value, 0, 200); } }); Cheers 1 Link to comment Share on other sites More sharing options...
3fingers Posted May 30, 2019 Share Posted May 30, 2019 Thanks @Wanze! I found my solution : wire()->addHookAfter('SeoMaestro::renderMetatags', function($event) { $tags = $event->return; $page = $event->wire('page'); foreach($tags as $key => $value) { if($key == 'image' && $key != '') { $matrix_field = $page->matrix->find('type=immagine_singola')->first(); // immagine_singola is my matrix type $matrix_image = $matrix_field->immagine_articolo->url(); // immagine_articolo is the field inside $tags[$key] = $matrix_image; } } }); I have to refactor something, but for now it's ok. Guys, you rock ? 1 Link to comment Share on other sites More sharing options...
Mikie Posted May 30, 2019 Share Posted May 30, 2019 Nice one @3fingers. 13 hours ago, Wanze said: Would be way easier if this could be left to a template engine ? Thanks @Wanze hook works great. I like this truncate function, simple and works as advertised: https://www.the-art-of-web.com/php/truncate/ Regarding the above when you say left to the template engine what do you mean? I assume disable that tag from automatic output by Seo Maestro and add yourself using eg twig filter? 1 Link to comment Share on other sites More sharing options...
Wanze Posted May 31, 2019 Author Share Posted May 31, 2019 19 hours ago, Mikie said: Regarding the above when you say left to the template engine what do you mean? I assume disable that tag from automatic output by Seo Maestro and add yourself using eg twig filter? I was referring to your example on how to apply a truncate function within the placeholder: {field|truncate:200} This would be nice but requires a custom implementation because the placeholder-parser of ProcessWire cannot handle this expression. If we had a more sophisticated template engine available, this would be an easy task ? Link to comment Share on other sites More sharing options...
Wanze Posted June 1, 2019 Author Share Posted June 1, 2019 I just released version 0.7.0 of the module: It fixes the ugly label being showed above the "inhterit" checkbox for newer Processwire versions. I think there is a bug in core, because ProcessWire ignores the fact that the label is marked as "hidden". I had to fix it via CSS for now. Added the possibility to resize the Opengraph image when referencing a page image by specifying a width and/or height. Opengraph image: If the referenced image field is empty and pulls the image from another page (default value), the module now substitutes the default image as well. Other than that the readme now contains a chapter for the various hooks provided by SeoMaestro. This might be interesting if you need to customize the behaviour of the module. Please let me know if you find any issues! ? Cheers 5 Link to comment Share on other sites More sharing options...
Wanze Posted June 15, 2019 Author Share Posted June 15, 2019 Version 0.8.0 has been released: Adds facebook share preview for content editors when editing Opengraph meta data Adds support to extend the rendered meta title with additional information such as the domain or site name (#11) Renders structured data (JSON-LD) for breadcrumbs via new group "structuredData" (#10) Adds new meta group "structuredData" which will handle more types of structured data in the future ? Happy weekend everyone! Cheers 8 1 Link to comment Share on other sites More sharing options...
flydev Posted June 15, 2019 Share Posted June 15, 2019 @Wanze please force the module directory update ?? 2 Link to comment Share on other sites More sharing options...
Wanze Posted June 15, 2019 Author Share Posted June 15, 2019 47 minutes ago, flydev said: @Wanze please force the module directory update ?? Done, thanks for the hint! ? I was thinking that ProcessWire would update this information regularly? ? 1 2 Link to comment Share on other sites More sharing options...
Juergen Posted June 16, 2019 Share Posted June 16, 2019 Thank you @Wanze for the additions (especially for the structured data)!! 2 Link to comment Share on other sites More sharing options...
Juergen Posted June 20, 2019 Share Posted June 20, 2019 Hi, I am struggeling with a problem to set the robots metatags (noIndex, noFollow) within a before page save hook. Here is my code (inside ready.php): $pages->addHookBefore('save', function($event) { $page = $event->arguments('page'); if($page->template == 'privacy-policy' || $page->template == 'search' || $page->template == 'error') { //SEO Maestro $page->seo->sitemap->include = 0; $page->seo->sitemap->priority = ''; //How to set robots to no index and no follow //??????????? } }); I could not figure out a way to accomplish this. Can anyone help me out? Thanks Link to comment Share on other sites More sharing options...
Wanze Posted June 21, 2019 Author Share Posted June 21, 2019 Hi @Juergen This should work: $page->seo->robots->noIndex = 1; $page->seo->robots->noFollow = 1; Cheers 2 1 Link to comment Share on other sites More sharing options...
Juergen Posted June 21, 2019 Share Posted June 21, 2019 Thank you @Wanze, I have tried this before, but without luck. Now I see what went wrong - I haven´t used camelcase (noindex instead of noIndex) - silly mistake ? 1 Link to comment Share on other sites More sharing options...
Jon Posted June 24, 2019 Share Posted June 24, 2019 Hello, Iam just trying to install the module but getting the following error any ideas? :- "Parse Error: syntax error, unexpected '?' (line 50 of /home/skyewalkerhostel/public_html/site/modules/SeoMaestro/InputfieldSeoMaestro.module.php) " Using PHP7.2 & PW 3.0.128 Link to comment Share on other sites More sharing options...
Wanze Posted June 25, 2019 Author Share Posted June 25, 2019 8 hours ago, Jon said: Hello, Iam just trying to install the module but getting the following error any ideas? :- "Parse Error: syntax error, unexpected '?' (line 50 of /home/skyewalkerhostel/public_html/site/modules/SeoMaestro/InputfieldSeoMaestro.module.php) " Using PHP7.2 & PW 3.0.128 The line in question is: $isTranslatable = $info['translatable'] ?? false; The "Null coalescing" operator was introduced with PHP 7 - are you sure you're using PHP 7.2? ? 2 1 Link to comment Share on other sites More sharing options...
Jon Posted June 25, 2019 Share Posted June 25, 2019 6 hours ago, Wanze said: The line in question is: $isTranslatable = $info['translatable'] ?? false; The "Null coalescing" operator was introduced with PHP 7 - are you sure you're using PHP 7.2? ? Nope Iam no longer sure, turned out to be 5.6 set in cpanel and 7.2 in whm. ? Thanks for your help ? 1 Link to comment Share on other sites More sharing options...
Spiria Posted June 26, 2019 Share Posted June 26, 2019 Hi @Wanze Since your breadcrumb addition (0.8), your module is no more compatible with Template Latte Replace module. While I can, in theory prevent the structured_data_breadcrumb template file in the Latte module, this doesn't function. Any idea how to circumvent the problem? Link to comment Share on other sites More sharing options...
tpr Posted June 26, 2019 Share Posted June 26, 2019 In the Latte module settings add the template name to the excluded templates list. Link to comment Share on other sites More sharing options...
Spiria Posted June 26, 2019 Share Posted June 26, 2019 As said, this does not work for me. Link to comment Share on other sites More sharing options...
tpr Posted June 26, 2019 Share Posted June 26, 2019 I see. Unfortunately I don't have this issue but perhaps it's a version mismatch or a result of your template setup (I see "controllers" in the path). I can try to reproduce if you tell these details. Anyway, it's sure not SeoMaestro module's fault, maybe this thread could be merged to the main Latte one? Link to comment Share on other sites More sharing options...
Spiria Posted June 26, 2019 Share Posted June 26, 2019 My programmers prefer to seperate views and controllers, so they configured this in config.php $config->paths->templates = $sitePath . "templates/controllers/"; //$config->paths->views = $sitePath . "templates/views"; The SEO module was working perfectly well with this until the new version. I will ask in the Latter forum. Link to comment Share on other sites More sharing options...
tpr Posted June 26, 2019 Share Posted June 26, 2019 Ok, in theory you can circumwent this by creating the missing .latte file and in there include the SeoMaestro module's php file. Link to comment Share on other sites More sharing options...
Spiria Posted June 26, 2019 Share Posted June 26, 2019 Yeah, I just don't want to code something that will have to be changed each time this module is enhanced... ? Link to comment Share on other sites More sharing options...
Mikie Posted July 1, 2019 Share Posted July 1, 2019 Hi @Wanze, getting an error with 0.8.0 update with the structured data breadcrumb template using TemplateLatteReplace module. Its fine as I can ignore that file with Latte using the module settings, but maybe changes relying on rendering templates like this should default to unchecked, as I assume same issue would occur with other template systems. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now