Jump to content

MarkupSEO - The all-in-one SEO solution for ProcessWire.


Nico Knoll

Recommended Posts

  On 7/31/2017 at 10:02 AM, tpr said:

I guess you could check $page->seo->description and if it's empty, set it to your likings, eg. in ready.php or in your template php file (latter untested).

if($page->seo_description === "") {
	$page->seo_description = 'whatever';
}

 

Expand  

Thank you for the answer.

The problem is, that i activated the "automatically" method to insert the code on my page. And the module inserts the empty description metatag anyway.

I don't know, if your code example will help me in this case?

Link to comment
Share on other sites

Just fast from mobile....

You have to use a hook on pagesave and check the SEO fields there....I ve some functions for creating keywords and description from some given fields... May tomorow I can post an example...

Link to comment
Share on other sites

  On 7/31/2017 at 10:29 AM, tpr said:

It should.

Expand  

YES! It works!
Thank you very much!!!

I unchecked the option "smart description" an add the code below in my template.

<?
    if($page->seo_description === "") {
       // Remove HTML tags
       $description = strip_tags($page->mytext);

       // Remove linebreaks
       $description = preg_replace( "/\r|\n/", " ", $description );

       // Shorten text
       $description = substr($description, 0, 160)." …";

       // Set new metadescription
       $page->seo_description = $description;
    }
    ?>

 

Link to comment
Share on other sites

Ok great that it works for you....a more complex solution with a hook on saveReady if SEO fields are empty put some own magic in there....if tey not empty do nothing...

functions that i use:

  Reveal hidden contents

the hook itself works in admin.php under site/templates/:

  Reveal hidden contents

As always it is not the best PHP code since im no professional....but it works for me....if i somedays get some time i could add something like that with optionfields to the module itself. ;)

Best regards mr-fan

  • Like 1
Link to comment
Share on other sites

  On 8/2/2017 at 6:34 AM, mr-fan said:

Ok great that it works for you....a more complex solution with a hook on saveReady if SEO fields are empty put some own magic in there....if tey not empty do nothing...

functions that i use:

  Reveal hidden contents

the hook itself works in admin.php under site/templates/:

  Reveal hidden contents

As always it is not the best PHP code since im no professional....but it works for me....if i somedays get some time i could add something like that with optionfields to the module itself. ;)

Best regards mr-fan

Expand  

WOW, that seems to be the sophisticated version ... :-)

An optionfiled in the module would be great!!!

Best regards!

 

Link to comment
Share on other sites

  • 2 months later...

Can I revive the subject ? :)

I want to use this module for a website I inherited, (I didn't use the processwire before)

There is one thing that makes me uncertain.

In:  Choose the templates which should get a SEO tab 
There is a note Be careful with this field. If you remove an entry all of it's "seo_*" fields get deleted (including the data).

Is there any risk there

An do I have to type in the Author and Sitename?

2017-10-25_102907.jpg

Link to comment
Share on other sites

  On 10/25/2017 at 8:31 AM, Marudor said:

Is there any risk there

Expand  

This simply means that if you assign a template that can use the SEO fields and then you actually use them on a page and then remove the template from the list, the SEO fields will be deleted from the template and, therefore, the pages assigned to it.

  On 10/25/2017 at 8:31 AM, Marudor said:

An do I have to type in the Author and Sitename?

Expand  

I believe the module's <head> markup might require it, so yes, I'd fill those out.

Link to comment
Share on other sites

  On 10/25/2017 at 2:47 PM, Marudor said:

OK thanks

Just to clarify - The author here - means the author of the module or the author of the website  or it doesn't matter what I type in there.

I don't want to blow up the site...:-X

Expand  

:lol: Author of the site. I think you can exclude it as I'd imagine the module won't include the relevant tag if it hasn't been specified. You'd need to "view source" in your browser to check if everything is okay. As far as I'm concerned, only the site title is important in terms of meta data.

Link to comment
Share on other sites

Ok I have chosen the template to MarkupSEO module.  

I does change the meta description and meta keyword which is very handy.

But it didn't change the meta title tag.

It's still the one withe the suffix added that comes from the homepage title 

Eventhough i have type in the short one Employer branding - pracownik staje się klientem - Poznań, Warszawa

I still have Employer branding - pracownik staje się klientem - Agencja PR Q&A Communications – Poznań, Warszawa

Where is the problem ? Why id doesn't change the title tag????

Link to comment
Share on other sites

  On 10/27/2017 at 10:28 AM, Marudor said:

Ok I have chosen the template to MarkupSEO module.  

I does change the meta description and meta keyword which is very handy.

But it didn't change the meta title tag.

It's still the one withe the suffix added that comes from the homepage title 

Eventhough i have type in the short one Employer branding - pracownik staje się klientem - Poznań, Warszawa

I still have Employer branding - pracownik staje się klientem - Agencja PR Q&A Communications – Poznań, Warszawa

Where is the problem ? Why id doesn't change the title tag????

Expand  

Changing the title in the SEO tab only affects the SEO title (<meta property="og:title" content="...SEO title...">). Your page title in the browser is the one you set in the <title> tag of your HTML. If you are referring to Google showing the old one, then you will need to wait a while for it to be re-indexed.

Edit: I apologise, it seems I'm incorrect. MarkupSEO will include a <title> tag for you if you fill out "Title Format" in that case, make sure you don't have your own <title> tag as well.

Link to comment
Share on other sites

I tough this is the module to change the meta title tag and meta description tag.

It changes the description and keyword all right...but the meta title  stays the same.

I  have the article title -  Employer branding - pracownik staje się klientem

But I want the meta title Employer branding - pracownik staje się klientem - Poznań, Warszawa

At the moment the meta title on every psgr is a mix of 2  - the article title and the suffix from the homepage title Agencja PR Q&A Communications – Poznań, Warszawa

I have even changed it in the code from 

<title><?php if($page->id > 1) { echo $page->title .' - '; } echo $home->title ?></title>
TO
<title><?php echo $page->title; ?></title>

BUT still the same. The mix of title with the suffix Agencja PR Q&A Communications – Poznań, Warszawa

added to all article titles makes the meta tag title too long. It Is more than 70 characters on every page. which is no good.

Link to comment
Share on other sites

  On 10/29/2017 at 1:59 PM, Marudor said:
<title><?php if($page->id > 1) { echo $page->title .' - '; } echo $home->title ?></title>
TO
<title><?php echo $page->title; ?></title>

BUT still the same.

Expand  

It sounds like you need to change it somewhere else. Because ProcessWire based sites always depend on the developer to implement the frontend, it can be tricky to find the right piece of code. Have you tried something like  <title>AAAAAA<?php echo $page->title; ?></title> for example? As a last resort I always type in some fake string which can be easily searched. If it is not in the source code of the rendered page then that is not right part of the code to change it. You probably need to dig in more, unfortunately.

Link to comment
Share on other sites

  • 3 months later...

Hello, I found & fixed an issue wich gives you an illegal string offset error in the latest PHP version. (7.1). 

Around line 429 you declare $return = ''; and then fill it up as an array doing $return[$key] = $value; at line 435.

All you got to do is declare $return = array(); instead of $return = ''; and it should be fixed. Filling up an empty string as an array caused the errors. Can you fix this and push it to github? :)

Kind regards,
Jonathan

 

	private function parseCustom($custom) {
		if(trim($custom) == '') return;

		$return = array();
		$lines = explode(PHP_EOL, $custom);
		foreach($lines as $line) {
			list($key, $value) = explode(':=', $line);
			$key = preg_replace('%[^A-Za-z0-9\-\.\:\_]+%', '', str_replace(' ', '-', trim($key)));	
			$value = trim(wire('sanitizer')->text(html_entity_decode($value)));

			$return[$key] = $value;
		}
		
		return $return;
	}

 

  • Thanks 2
Link to comment
Share on other sites

  • 3 weeks later...

Hi,
I'm having a problem with this module. I't installed with Processwire ver3.
The problem is -> on localhost plugin is working fine, but on live server plugin is not working (strange is that it was working fine, but stopped without any reason ):
when i type title, keywords and description and click SAVE, page is reloaded without errors, but i see old entries, so cannot update existing entries.
I was able to edit Title and description, but next attempts fails. So it saves SEO daya randomly, sometimes im able to edit and save, and sometimes it will just return previous values.

Does anybody has this issue ? Thanks.

Actually im seeing this on edit page in SEO TAB

image.png.2c9ee50f8dfef7641101278db0765e35.png

Link to comment
Share on other sites

  • 3 weeks later...

If anyone is interested, I have a new fork of this module available here: https://github.com/adrianbj/MarkupSEO/commits/various-fixes-enhancements

It's very much a work in progress, but it includes several bug fixes and lots of new features. Please read the commit log to learn about what's fixed and what's new.

At the moment you should not upgrade an existing site (new fields won't be created) and probably don't use it on a live site just yet.

It's not well tested at all yet, so use at your own peril :) 

I'd really appreciate any feedback on it.

  • Like 14
  • Thanks 2
Link to comment
Share on other sites

@adrian

Hi Adrian, thank you for the awesome updates and improvements.

I would suggest to take a look on the Canonical link field and make it ready for multi language websites .

Meaning that he can detect if there are any other languages present and canonicalize them properly according to the languages. 

 

  • Like 1
Link to comment
Share on other sites

  On 3/11/2018 at 12:14 PM, B3ta said:

I would suggest to take a look on the Canonical link field and make it ready for multi language websites .

Expand  

Hi @B3ta - I'm afraid I don't really have time to look into this at the moment. I am extending this module for my needs and I rarely have multi-language websites so it's not high on my list. I am happy to accept PRs though so together we can build a better version of this module. Once we are all happy with the stability/functionality of the new version I'll try contacting Nico to see what we can do about getting it into the main repo. Hope you understand where I am coming from.

  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...
  On 3/25/2018 at 2:36 PM, neosin said:

@Nico Knoll for the images, it requires a URL; I am curious if I change those to file upload field will it affect the module? just want to confirm before I try, thank you

Expand  

In my fork (linked above), the field is an images field (for the page specific SEO tab, not the default image).

  • Like 1
Link to comment
Share on other sites

  On 3/25/2018 at 3:08 PM, adrian said:

In my fork (linked above), the field is an images field (for the page specific SEO tab, not the default image).

Expand  

thank you, I will check it out now

@adrian I've uninstalled the SEO and installed your version however the SEO image fields still show up as url text fields. Do I need to change the fields to images?

Link to comment
Share on other sites

  • 4 weeks later...

Hi,

EDIT: Found it, change it in the module configuration. Can't be overwritten by field definition.

 

i cannot change the length of the seo_title field. I changed the field max length to 100 but it is still 60 at the input field. i tried to remove the counter to check, does not work. Tried to change the title and description of the field, this works. I'm confused.

 

Thx for any help!

seotitle.jpg

Link to comment
Share on other sites

  • 2 weeks later...
  On 3/25/2018 at 3:48 PM, neosin said:

thank you, I will check it out now

@adrian I've uninstalled the SEO and installed your version however the SEO image fields still show up as url text fields. Do I need to change the fields to images?

Expand  

Sorry I missed this - not getting emails on @ pings anymore. If you upgrade from an old install of this module, you will need to manually change the field type.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...