alexm Posted January 7, 2020 Share Posted January 7, 2020 (edited) I'm seeing an issue whereby children of a page aren't showing in the sitemap. Robots noindex isn't checked and SEO fields are applied to the necessary template for those pages however. Any thoughts on this? EDIT: Ignore this... I'm being stoopid Edited January 8, 2020 by alexmercenary Link to comment Share on other sites More sharing options...
gebeer Posted January 9, 2020 Share Posted January 9, 2020 I just installed v1.0.0 on PW 3.0.142 and seeing a problem with german umlauts in The Google preview and inherited title. The site has Language Support installed, just to have the backend translated to German. No additional languages. Field title is of type Page Title with textformatter HTML Entity Encoder (standard setting). umlauts.mp4 The title is saved in DB field_title as 'Über uns'. Removing the Entity Encoder Textformatter doesn't help. EDIT: page title is also rendered in the wrong format: Can anyone reproduce this issue? A fix would be greatly appreciated. EDIT: This solution from github issues fixed it for me. 2 Link to comment Share on other sites More sharing options...
Frank Vèssia Posted January 24, 2020 Share Posted January 24, 2020 I just discovered this module, neat! I only have a little issue, the facebook tags render the url value without https (both image and url) when the canonical is correct with https, any solutions? Link to comment Share on other sites More sharing options...
Wanze Posted February 1, 2020 Author Share Posted February 1, 2020 Finally released a new version 1.0.1 which should fix the double encoding issues. Please update and report if you still encounter problems. @Sevarf2 Can you check the "Base URL" setting in the module's config? 1 Link to comment Share on other sites More sharing options...
Frank Vèssia Posted February 1, 2020 Share Posted February 1, 2020 2 hours ago, Wanze said: Finally released a new version 1.0.1 which should fix the double encoding issues. Please update and report if you still encounter problems. @Sevarf2 Can you check the "Base URL" setting in the module's config? I already checked, it's ok, with https. btw, the base url in the module config is used for the sitemap not for the meta tags. Link to comment Share on other sites More sharing options...
Wanze Posted February 2, 2020 Author Share Posted February 2, 2020 15 hours ago, Sevarf2 said: I already checked, it's ok, with https. btw, the base url in the module config is used for the sitemap not for the meta tags. The module uses $page->httpUrl to generate the URL. The protocol of this method is resolved by settings on template and config level ($template->https / $config->noHTTPS). Can you check both of them? The base url is used for the sitemap but also for the canonical url metatag. ? Cheers Link to comment Share on other sites More sharing options...
Mikie Posted February 20, 2020 Share Posted February 20, 2020 Hey @Wanze, would be good to be able to set default change frequency to null by default. See here for info from google rep: https://www.seroundtable.com/google-priority-change-frequency-xml-sitemap-20273.html Link to comment Share on other sites More sharing options...
gebeer Posted March 11, 2020 Share Posted March 11, 2020 Hi, I'm facing a strange issue with priority values being output with colon (0,5) instead of period (0.5) which I guess is wrong. On some servers PW issues a warning to translate the locale setting: I have a site with a single language (German) and language support enabled to have the backend translated to German. So I translated the locale setting to de_DE.UTF-8 But now sitemap items that are generated through a hook will output 0,5 (which is correct for German locale). Other pages in the sitemap output correctly like 0.5. I have automatic sitemap generation disabled because I update it manually whenever some data changes that comes from an external XML and is converted to virtual pages on runtime that do not get saved to the DB. My code for adding those virtual page entries to the sitemap public function updateXmlSitemap() { $config = $this->wire('modules')->getConfig('SeoMaestro'); $items = $this->stellenangeboteXMLToPageArray(); // results in array of virtual pages $entries = array(); foreach ($items as $item) { $entry = (new SitemapItem()) ->set('loc', $config['baseUrl'] . $item->url) ->set('lastmod', date('c'), time()) ->set('priority', (float) 0.7) // casting explicitly to float doesn't help ->set('changefreq', 'daily'); $entries[] = $entry; } $this->addHookAfter('SeoMaestro::sitemapItems', function (HookEvent $event) use ($entries) { $event->return = array_merge($event->return, $entries); // add my entries to the sitemap }); $manager = new SitemapManager($config); try { $sitemap = $manager->generate($this->wire('config')->paths->root . $config['sitemapPath']); if (!$sitemap) { $this->wire('log')->save(strtolower($this->className), 'Could not generate sitemap'); } else { $this->wire('log')->save(strtolower($this->className), 'sitemap generated'); } } catch (\Throwable $th) { $this->wire('log')->save($this->className, 'Error generating sitemap' . $th->getMessage()); } } I don't know why the items added to the sitemap through my hook produce different output (0,5) from the items that are generated by the module (0.5). Could you make sure in the module code that the priority value is always being rendered as a float value, no matter what locale setting? That would be awesome. Link to comment Share on other sites More sharing options...
BenSlayers Posted March 12, 2020 Share Posted March 12, 2020 On 3/12/2019 at 6:20 AM, Wanze said: @tiefenbacher_bluetomato Here is an example script from my migration. $pages = $this->wire('pages')->findMany("seo_title|seo_description!='',include=all"); foreach ($pages as $page) { if (!$page->hasField('seo')) { continue; } $page->of(false); foreach ($this->wire('languages') as $language) { $this->wire('user')->language = $language; $title = $page->seo_title->getLanguageValue($language); $desc = $page->seo_description->getLanguageValue($language); $page->seo->meta->title = $title ?: 'inherit'; $page->seo->meta->description = $desc ?: 'inherit'; } $page->save(); } Hi, I'd like to add this module to an existing site that is 400+ pages, I see you have this handy-dandy script and it should work perfectly for my needs because my setup is identical to yours - basically, I have a text field (seo_title) and a textarea field (seo_description) that I would like to copy over to my new seomaestro field (seo). I've installed the Migrations module but I have no idea how to run this script with it. I tried looking through the Migrations forum but it's all Greek to me. I'm hoping one of you talented folks can shed some light so I don't have to copy and paste 800 lines of text, lol. Thanks! ? Link to comment Share on other sites More sharing options...
horst Posted March 13, 2020 Share Posted March 13, 2020 (edited) Hi @Ben Sayers, are you sure that you need to use the migration module for that onetime migration? For me it looks like you simply can run this example script once (with your fieldnames) and then you are ready. To do this, you can create a php file with a name you like, in your root directory, besides the index.php. Calling this script will bootstrap PW and do all your desired work. Here an example. NOTE: Not tested, written in the browser! Before running this, do a BACKUP-COPY of your database, so have option to roll back, when something went wrong. <?php namespace ProcessWire; // prepare server for continuous output if(function_exists('apache_setenv')) @apache_setenv('no-gzip', '1'); @ini_set('zlib.output_compression', 'Off'); @ini_set('output_buffering ', '0'); @ini_set('implicit_flush', '1'); @ob_implicit_flush(true); @ob_end_flush(); //if(isset($_SERVER['HTTP_HOST'])) header('Content-Type: text/plain'); // bootstrap PW require_once('./index.php'); // here you bootstrap PW, after that line you will have available the most PW variables and functions. if(!$user->isSuperuser()) { // when using those scripts online, I do secure them with forcing a login in the admin as Superuser, ... echo "ACCESS DENIED! ($user->name)"; exit(1); } elseif($user->isSuperuser() && 'horst' == $user->name) { // and where are multiple superusers registered, additionally limited to my username echo '<pre>'.$_SERVER['HTTP_HOST'].' :: '.basename(__FILE__)."\n"; $selector = " DEFINE YOUR SELECTOR HERE TO GET A PAGE ARRAY WITH YOUR PAGES "; $pa = $pages->find($selector); // or: $pa = $pages->findMany($selector); $max = count($pa); $cur = 0; foreach($pa as $p) { // loop over all collected pages set_time_limit(30); // renew the time limit for each loop, so that you may run this script long times, but lets it time out on failures in a reasonable short timeframe $cur++; // following do your work if(!$p->hasField('seo')) { continue; } echo " - [$cur / $max] {$p->title}\n"; $p->of(false); foreach (wire('languages') as $lang) { wire('user')->language = $lang; $title = $p->seo_title->getLanguageValue($lang); $desc = $p->seo_description->getLanguageValue($lang); $p->seo->meta->title = $title ?: 'inherit'; $p->seo->meta->description = $desc ?: 'inherit'; } $p->save(); $pages->uncacheAll($p); // after saving, uncahe the current page //die('BREAK!!'); // just when first test the script before processing all items } die('<p>READY!</p>'); } die('RIP'); Edited March 13, 2020 by horst added notice to do a DB backup first 2 Link to comment Share on other sites More sharing options...
BenSlayers Posted March 13, 2020 Share Posted March 13, 2020 (edited) 3 hours ago, horst said: Here an example. NOTE: Not tested, written in the browser Hi @horst, thanks for the tips! I definitely don't need to use the migrator module, I didn't even know you could run a script like this, lol. So I backed up my DB and copied your script to a new file (seomigrate.php), uploaded that next to index.php in root and then opened that file in a browser but all I see is "RIP". I checked my pages and none of the data has been copied to the seo field. I thought maybe it was my selector so I found this ProcessSelectorTest module to verify the selector is working correctly, there were 343 pages found. Any idea what I'm doing wrong? I'm not much of a programmer, mostly a front-end guy so please forgive my ignorance ?♂️ <?php namespace ProcessWire; // prepare server for continuous output if(function_exists('apache_setenv')) @apache_setenv('no-gzip', '1'); @ini_set('zlib.output_compression', 'Off'); @ini_set('output_buffering ', '0'); @ini_set('implicit_flush', '1'); @ob_implicit_flush(true); @ob_end_flush(); //if(isset($_SERVER['HTTP_HOST'])) header('Content-Type: text/plain'); // bootstrap PW require_once('./index.php'); // here you bootstrap PW, after that line you will have available the most PW variables and functions. if(!$user->isSuperuser()) { // when using those scripts online, I do secure them with forcing a login in the admin as Superuser, ... echo "ACCESS DENIED! ($user->name)"; exit(1); } elseif($user->isSuperuser() && 'horst' == $user->name) { // and where are multiple superusers registered, additionally limited to my username echo '<pre>'.$_SERVER['HTTP_HOST'].' :: '.basename(__FILE__)."\n"; $selector = " seo_title|seo_description!='',include=all "; $pa = $pages->find($selector); // or: $pa = $pages->findMany($selector); $max = count($pa); $cur = 0; foreach($pa as $p) { // loop over all collected pages set_time_limit(30); // renew the time limit for each loop, so that you may run this script long times, but lets it time out on failures in a reasonable short timeframe $cur++; // following do your work if(!$p->hasField('seo')) { continue; } echo " - [$cur / $max] {$p->title}\n"; $p->of(false); foreach (wire('languages') as $lang) { wire('user')->language = $lang; $title = $p->seo_title->getLanguageValue($lang); $desc = $p->seo_description->getLanguageValue($lang); $p->seo->meta->title = $title ?: 'inherit'; $p->seo->meta->description = $desc ?: 'inherit'; } $p->save(); $pages->uncacheAll($p); // after saving, uncahe the current page //die('BREAK!!'); // just when first test the script before processing all items } die('<p>READY!</p>'); } die('RIP'); ?> Edited March 13, 2020 by Ben Sayers added my script Link to comment Share on other sites More sharing options...
horst Posted March 13, 2020 Share Posted March 13, 2020 Hi, you need to remove my name from the check, if its a Superuser, who called the script. Please follow the comments in the script to adapt all parts to suit your needs, (selector, fieldnames, ...), and you may add some temporary checks when testing the script first time. AT FIRST, uncomment the //die('BREAK!!'); line, so that you only test with one page. (Script stops after first loop). Maybe this is already all what is to do. If not, come back and tell what is missing or has happened. 1 Link to comment Share on other sites More sharing options...
BenSlayers Posted March 13, 2020 Share Posted March 13, 2020 (edited) 6 minutes ago, horst said: Hi, you need to remove my name from the check, if its a Superuser, who called the script. Wow, I can't believe I missed that, sorry. OK, so I replaced your name with mine (admin) and uncommented die('BREAK!!'); - now I see the following message but when I open the homepage in PW, the text from seo_title and seo_description hasn't been added to title and description in the seo field. www.domain.com :: seomigrate.php - [1 / 343] Home BREAK!! Edited March 13, 2020 by Ben Sayers removed domain name Link to comment Share on other sites More sharing options...
horst Posted March 13, 2020 Share Posted March 13, 2020 20 minutes ago, Ben Sayers said: $p->save(); so you need to check that the fieldnames (your old fieldnames and the new ones) are adressed correct in the script part that came from Wanze. Also you can output the result of the save() method, for example by using var_dump($p->save()); 1 Link to comment Share on other sites More sharing options...
BenSlayers Posted March 13, 2020 Share Posted March 13, 2020 Just now, horst said: so you need to check that the fieldnames (your old fieldnames and the new ones) are adressed correct in the script part that came from Wanze. Also you can output the result of the save() method, for example by using var_dump($p->save()); Does it matter that my site only has one language (english)? I see that the foreach from Wanze is for a multi-language site. Link to comment Share on other sites More sharing options...
horst Posted March 13, 2020 Share Posted March 13, 2020 then you can let this out. try it like this: $p->of(false); $title = trim($p->get('seo_title')); $title = $title ? $title : 'inherit'; $desc = trim($p->get('seo_description')); $desc = $desc ? $desc : 'inherit'; var_dump($title); var_dump($desc); $p->seo->meta->title = $title; $p->seo->meta->description = $desc; echo $p->save() ? " - 1" : " - 0"; 1 Link to comment Share on other sites More sharing options...
BenSlayers Posted March 13, 2020 Share Posted March 13, 2020 10 minutes ago, horst said: try it like this: Yeah dude - that was it!! THANKS! So now, I can just comment out the die('BREAK!!'); and reload the script? Then if everything looks good, remove the script from the server? Link to comment Share on other sites More sharing options...
horst Posted March 13, 2020 Share Posted March 13, 2020 Yep. ? Link to comment Share on other sites More sharing options...
BenSlayers Posted March 13, 2020 Share Posted March 13, 2020 1 hour ago, horst said: Yep. ? Very nice, that worked flawlessly. Thank you so much for your help @horst, what a time-saver! Cheers ? Link to comment Share on other sites More sharing options...
BenSlayers Posted March 17, 2020 Share Posted March 17, 2020 Hi all, I'm having an issue on my search page when using SeoMaestro, any idea how to resolve? Error: Exception: Operator '~=' is not implemented in FieldtypeSeoMaestro (in /home/kbellaspa/public_html/wire/core/Fieldtype.php line 693) Link to comment Share on other sites More sharing options...
Wanze Posted March 18, 2020 Author Share Posted March 18, 2020 @Ben Sayers Are you trying to search meta data in a SeoMaestro field? Unfortunately this is not possible due to the data structure being used by the module, see: https://github.com/wanze/SeoMaestro#available-selectors Cheers Link to comment Share on other sites More sharing options...
fliwire Posted March 27, 2020 Share Posted March 27, 2020 If admin language not default language, default language saved properly, but when showing field has wrong value. Overwrite seo field for home template: opengraph_description has value: "{seo.meta.description}". DB Data: {"opengraph_description":"{seo.meta.description1}","opengraph_description1033":"{seo.meta.description2}","opengraph_description1185":"{seo.meta.description3}"} Link to comment Share on other sites More sharing options...
HerTha Posted April 5, 2020 Share Posted April 5, 2020 Hi @Wanze thanks for this fantastic module! Is there a way to control how the module's XML sitemap generator handles hidden pages? Link to comment Share on other sites More sharing options...
palacios000 Posted April 9, 2020 Share Posted April 9, 2020 Thanks for this module. Is there a way to sanitize the description field in order to remove HTML tags? The field I set up to display the default og: description is a textarea with HTML formatting... This is how is rendered on the page: <meta property="og:description" content="<p>La linea di Pomate Freita&nbsp;Bio&... Thanks for your help! Link to comment Share on other sites More sharing options...
Wanze Posted April 13, 2020 Author Share Posted April 13, 2020 On 4/9/2020 at 10:18 AM, palacios000 said: Thanks for this module. Is there a way to sanitize the description field in order to remove HTML tags? The field I set up to display the default og: description is a textarea with HTML formatting... This is how is rendered on the page: <meta property="og:description" content="<p>La linea di Pomate Freita&nbsp;Bio&... Thanks for your help! Hi @palacios000 There is no setting to strip HTML tags, you'd need to use the following hook to transform the value prior to being rendered by the module: https://github.com/wanze/SeoMaestro#___renderseodatavalue Cheers 2 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