Jump to content
FWR Media

KissMT Dynamic SEO Meta & Canonical Header Tags

Recommended Posts

The difficulty is that KissMT has no idea how you require EVERY hyphenated string to be formatted, therefore it simply takes the string and capitalises the first letter as it does with all other strings.

 

Fair enough but can the store-name be isolated from the formatting?

Share this post


Link to post
Share on other sites

Fair enough but can the store-name be isolated from the formatting?

 

Not currently as it is appended as a part of the overall string.

Share this post


Link to post
Share on other sites

I've been thinking Robert, it's not just store_name and title, it's everything especially if you are selling something Scottish or Irish:

 

McFly, McDonald, MacBeth and every hyphenated logo of course

Edited by Xpajun

Share this post


Link to post
Share on other sites

I've been thinking Robert, it's not just store_name and title, it's everything especially if you are selling something Scottish or Irish:

 

McFly, McDonald, MacBeth and every hyphenated logo of course

 

Yup

 

The issue is that the system is dynamic.

 

The big upside is that meta data is produced for every product and every category etc. with zero input.

 

The downside is that the system has to make assumptions..

 

The good news is that these assumptions have no effect on SEO ( search engine SEO not user ) performance, the downside is that some words may have incorrect cases.

 

In the future I am planning an optional addon which will allow the meta data to be edited in admin.

Edited by FWR Media

Share this post


Link to post
Share on other sites

Yup

 

The issue is that the system is dynamic.

 

The big upside is that meta data is produced for every product and every category etc. with zero input.

 

The downside is that the system has to make assumptions..

 

Can it not make the assumption that what is written on the page is how we would like to see it in our titles etc. >_<

 

The good news is that these assumptions have no effect on SEO ( search engine SEO not user ) performance, the downside is that some words may have incorrect cases.

 

In the future I am planning an optional addon which will allow the meta data to be edited in admin.

 

Good to see that - would it be too much to hope that the future, in this case, happens before the end of this year? :-" :-"

Share this post


Link to post
Share on other sites

Can it not make the assumption that what is written on the page is how we would like to see it in our titles etc. >_<

 

LOL nope .. a lot of my time spent in writing these global use contributions revolves around negating the bad input of the user.

 

 

Good to see that - would it be too much to hope that the future, in this case, happens before the end of this year? whistling.gif

 

It will happen when I have the time to action it.

Share this post


Link to post
Share on other sites

Wow!

 

What more can one say

 

 

But I have one problem...

 

My store name has a hyphen followed by a capital letter:

 

Xpajun Off-Road

 

it's being converted to Xpajun Off-road, which is not right at all!

 

any chance of a work around?

 

Sorry FWR to barge in, I've had the opportunity to peer under the hood of this contribution and subsequently created an osC3 compatible version.

 

Just to remind everyone that words you don't want the first letter capitalized, put them in kiss_meta_tags/smallwords/english.php.

 

In this case, your company name would be entered as two separate words. They will be ignored, and passed as is.

Share this post


Link to post
Share on other sites

May have an effect elsewhere - have no idea why it is being changed to lowercase, then having the first letter capitalised. Rob?

 

If I take your example of ..

 

$ucfirst_words[] = ucfirst( strtolower( $it->current() ) );

 

This occurs in the method KissMT_Modules::formatTitleWords()

 

Here we explode into an array the word strings using the separator of a space.

 

Once the words are separated we iterate through them setting them first for uniformity to lower case then capitalising the first letter using ucfirst().

 

In your second example

 
$file_title = ucfirst( strtolower( str_replace( '_', ' ', $short_filename ) ) );

 

This occurs in the Generic Module and is used only when the define HEADING_TITLE is not defined and we are therefore presenting a filename.

 

This perhaps should be ucwords.

Edited by FWR Media

Share this post


Link to post
Share on other sites

"we iterate through them setting them first for uniformity to lower case then capitalising the first letter using ucfirst()."

 

For what reason?

 

Setting standard words to ucfirst and small words to lowercase.

 

A fair bit of research went into KissMT and re: titles: -

 

The correct English for a title involves capitalising all words except for small words ( such as conjunctions ) when they are not the first word. Other languages have their own "small words".

Edited by FWR Media

Share this post


Link to post
Share on other sites

I know what you are doing, I would like to know the reason. Cause and effect.

 

SEO purposes maybe, is there some idea floating about somewhere that meta and titles need to be presented in a certain way?

 

What I said above. There is a correct way to write a title.

 

What SEO effect this does or doesn't have is irrelevant .. 50% of SEO is the bots .. the other 50% the user. Writing titles correctly is purely professional.

Share this post


Link to post
Share on other sites

"The correct English for a title involves capitalising all words except for small words ( such as conjunctions ) when they are not the first word. Other languages have their own "small words". "

 

Where on earth did you get that idea from?

 

It is fact.

 

I'll live with the "McWords" they are few and far between ( irrelevant ).

 

This is detracting from the support thread .. happy to continue if you wish to start a separate thread somewhere but not here as it will make it difficult for users to find valid support cases.

Share this post


Link to post
Share on other sites

My post got overlooked in the exchange, but basically using the smallwords/english.php file solves the immediate question by the user. One can increase this file to one's content with all the McWords.

Share this post


Link to post
Share on other sites

It is fact.

 

I'll live with the "McWords" they are few and far between ( irrelevant ).

 

This is detracting from the support thread .. happy to continue if you wish to start a separate thread somewhere but not here as it will make it difficult for users to find valid support cases.

 

 

Rob you may not think so but this is asking for support

 

Your contribution is too pedantic for the modern selling world where it is important to have a description showing as written not lowercase starting with an uppercase.

 

Take a good look around the selling world - see how they present their logos - to do a strtolower first removes designs that business pay thousands of pounds for. If that doesn't concern you have a look in your dictionary at all the abbreviations and acronyms that could/may/will be used in the title of a website it is important to have capital letters in certain places within a string of letters.

 

 

So the support asked for (and I'm not the only one that has been asking for it) can we have an option where the output of your contribution can be as written on the page rather than being pedantic?

Share this post


Link to post
Share on other sites

So the support asked for (and I'm not the only one that has been asking for it) can we have an option where the output of your contribution can be as written on the page rather than being pedantic?

 

I always keep in mind any suggestions made in this forum where it is likely to be of benefit to the majority of users.

 

Other than that, any specific changes you require personally you will have to make yourself.

Share this post


Link to post
Share on other sites

Burt this is a support topic for KissMT and you are not seeking support.

 

You have made a point which has been noted but "make a point" is all you should do here and not continue with whatever agenda you are working to.

 

KissMT is a dynamic script that allows users to have meta tags and canonical elements without having to laboriously add this data manually. If users want to add meta data manually then they don't need a contribution at all they just need to add a few database fields and manually add them in admin and retrieve at the front end.

 

These things are (I presume) doing nothing but formatting words that shouldn't need to be formatted.

 

What you perhaps have not grasped is that because it is dynamic it has to deal with text that has been put in by the user which more often than not involves a number of sins. One of those sins e.g. is fully capitalised words, another is characters that have to be stripped, another is html tags, another is multiple spaces etc. etc. to believe it is as simple as just accepting the user input is naive.

 

KissMT needs to be able to deal with this "odd input" and therefore functionality is in place to deal with it. For this reason the strings have to be rationalised and one of the measures of rationalisation is to format the strings to lower case.

 

Should a user feel their strings are all perfect and do not require rationalisation then they are free to remove the formatting from the files.

Share this post


Link to post
Share on other sites

You might not have noticed that I am actually giving support with regards to this problem in your code, where you have chosen not to. No agenda other than that.

 

There is no problem in the code, a feature was requested that has never been requested before and it is being considered.

 

but equally, it should not need to be formatted in the way suggested by your code.

 

Sigh ..

 

So how do you suggest fully capitalised strings or badly capitalised strings should be dealt with if not by strtolower? Ask it nicely to desist?

Share this post


Link to post
Share on other sites

The following is a quick stop gap solution to the issue being discussed. It was quickly written so please retain a backup of the original kiss_meta_tags directory in case you need to revert.

1) Create a new php file ..

catalog/includes/modules/kiss_meta_tags/includes/important_words.php

 

Containing ..

 

<?php
 /**
 * @example
 * $important_words = array( 'KissMT' );
 */
 $important_words = array();

 

2) Open up

 

catalog/includes/modules/kiss_meta_tags/abstracts/kiss_modules/kiss_modules.php

 

Find ..

 

	protected $root_index = 'root'; // options - root = www.mysite.com/ - index = www.mysite.com/FILENAME_DEFAULT (index.php)

 

Change to ..

 

	protected $root_index = 'root'; // options - root = www.mysite.com/ - index = www.mysite.com/FILENAME_DEFAULT (index.php)
protected $important_words = array();

 

Find complete function formatTitleWords() ( lines 200 to 220 ) .. replace with ..

 

	private function formatTitleWords( $text ) {
 	include_once KissMT::init()->includes_path . 'important_words.php';
 	if ( isset( $important_words ) && is_array( $important_words ) ) {
   	$this->important_words = $important_words;
 	}
 	if ( !empty( KissMT::init()->smallwords ) ) {
   	$words_array = explode( ' ', $text );
   	$ucfirst_words = array();
   	$it = new ArrayIterator( $words_array );
   	while ( $it->valid() ) {
     	if( ctype_alpha( substr( $it->current(), 0, 1 ) ) ) {
       	if ( !in_array( $it->current(), KissMT::init()->smallwords ) ) {
         	$lower = strtolower( $it->current() );
         	foreach ( $this->important_words as $index => $word ) {
           	if ( false !== strpos( $lower, strtolower( $word ) ) ) {
             	$ucfirst_words[] = str_replace( strtolower( $word ), $word, $lower );
             	$it->next();
             	continue 2;  
           	}
         	}  
         	$ucfirst_words[] = ucfirst( $lower );
       	} else {
         	$ucfirst_words[] = $it->current();
       	} 
     	} elseif( tep_not_null( $it->current() ) ) {
       	$ucfirst_words[] = $it->current();
     	}
     	$it->next();
   	}
   	return $this->trimWordsToLength( implode( ' ', $ucfirst_words ), 'title' );
 	}
 	return $this->trimWordsToLength( $text, 'title' );
}

 

Now add any strings you do not wish to be formatted to the important_words array then reset the cache.

 

Please let me know how you get on with it.

Share this post


Link to post
Share on other sites

I've just tried your above mod Rob, thank you for taking the time to code it, and it sort of half works - by that I mean you have to play with the important words; for instance lets take Xpajun Off-Road:

 

If I put Xpajun Off-Road as an important word it outputs Xpajun Off-road

 

If I put -Road as an important word it outputs Xpajun off-Road

 

Only when I put in Off-Road as an important word does it output Xpajun Off-Road (though now I've written that I can see why :rolleyes: )

 

 

But in addition I have:

 

abbreviations - SWB LWB (they work)

 

series letters - A B (they do work but cAuse proBlems!)

 

model numbers - this is an interesting one ML2-DC-2 outputs as ML2-dc-2 while MP-2-SWB-2 outputs as mp-2-SWB-2 (I've tried various way of including these as important word with no luck) - why are these model numbers important? Because I use upper and lower case in the model make-up e.g. DC & Dc and dc could mean either. I know I could probably... wait one... no I thought that if I put in the full model number it would work but it doesn't, however as parts of the model number are repeated for different product model numbers that is not a real option

 

Currently I have altered the following in kiss_modules.php (as per Burt's suggestion above):

 

 


             $ucfirst_words[] = ucfirst( strtolower( $it->current() ) );

to

             $ucfirst_words[] = $it->current();

 

This gives a correct page heading especially on the product info pages where the model numbers are shown, I'm guessing that it may not be to your liking and may cause problems on some sites but in my case it is working well - had it been just the logo then I'd go for your mod - if you want any more testing done get in touch

Edited by Xpajun

Share this post


Link to post
Share on other sites

This gives a correct page heading especially on the product info pages where the model numbers are shown, I'm guessing that it may not be to your liking and may cause problems on some sites but in my case it is working well - had it been just the logo then I'd go for your mod - if you want any more testing done get in touch

 

It's not that it's not to my liking its that the core code could not be changed in that way as it would provide problems for the majority of users who "don't give a fig" about correct caps etc.

 

The fact that you have chosen to modify the files to meet your own needs is good and I appreciate you feeding back your thoughts.

Share this post


Link to post
Share on other sites

Rob, when you look at updating this contribution you might like to look at the following as well as my comments on my previous post:

 

apostrophe ' (you all ready know about)

 

double quote " for inch - 1 inch is so out of place 1" is the norm (yes we still use inches - ask any American)

 

forward slash / and/or - grass/sand/earth looks so much better than grass and sand and earth

 

Juls

Share this post


Link to post
Share on other sites

Rob, when you look at updating this contribution you might like to look at the following as well as my comments on my previous post:

 

apostrophe ' (you all ready know about)

 

double quote " for inch - 1 inch is so out of place 1" is the norm (yes we still use inches - ask any American)

 

forward slash / and/or - grass/sand/earth looks so much better than grass and sand and earth

 

Juls

 

Thanks for the feedback Juls but I certainly won't be allowing any special characters for the dynamic system.

 

I think special characters will come into play when I have added the ability for the meta data to also be set in admin.

 

So the dynamic system may create for ( e.g. category 32 )

 

Grass and Sand and Earth

 

You log into admin .. visit category 32 and change it to ..

 

Grass/Sand/Earth

 

Having said that Grass and Sand and Earth is better for seo purposes as / is not accepted as a valid word separator.

Share this post


Link to post
Share on other sites

Thanks for the feedback Juls but I certainly won't be allowing any special characters for the dynamic system.

 

I think special characters will come into play when I have added the ability for the meta data to also be set in admin.

 

So the dynamic system may create for ( e.g. category 32 )

 

Grass and Sand and Earth

 

You log into admin .. visit category 32 and change it to ..

 

Grass/Sand/Earth

 

Having said that Grass and Sand and Earth is better for seo purposes as / is not accepted as a valid word separator.

Being able to add meta tags manually will be the cherry on an already very nice cake.

 

About the Title "issue". If there was an option for no changes to be made to the title tag whatsoever that should cover any problems people might be experiencing.

 

Failing that I believe the title tag should appear just as it was entered by the user for the product or category title ie what you see on the page as the title of the product/category is what should be used for the title tag with zero changes

 

If some people can't be bothered to have correct grammar/spelling/character spacing etc etc for their product and category titles, that is their problem. People who take the time to write their titles correctly should not have their work undone (to a certain extent) just for the sake of other people's lack of care and/or competence.

 

That's my 2 cents :)

Share this post


Link to post
Share on other sites

Being able to add meta tags manually will be the cherry on an already very nice cake.

 

About the Title "issue". If there was an option for no changes to be made to the title tag whatsoever that should cover any problems people might be experiencing.

 

Failing that I believe the title tag should appear just as it was entered by the user for the product or category title ie what you see on the page as the title of the product/category is what should be used for the title tag with zero changes

 

If some people can't be bothered to have correct grammar/spelling/character spacing etc etc for their product and category titles, that is their problem. People who take the time to write their titles correctly should not have their work undone (to a certain extent) just for the sake of other people's lack of care and/or competence.

 

That's my 2 cents :)

 

Yes I fully understand and agree with the sentiment.

 

One of the big problems when writing contributions like this is catering for bad osCommerce installs.

 

If you don't code to meet the conditions of these bad installs then a contribution gets the reputation of "not working".

Share this post


Link to post
Share on other sites

Hello,

 

Ive made a boo boo somewhere, Im running 2.3 & just installed the latest download. All works good except for when in checkout, I click "confirm order" I get this error on the checkout.php page

 

 

 

Warning: KissMT could not find a valid base filename, please inform the developer. in /catalog/includes/modules/kiss_meta_tags/classes/kiss_meta_tags_class.php on line 141

 

Warning: include_once(/catalog/includes/modules/kiss_meta_tags/modules/) [function.include-once]: failed to open stream: No such file or directory in /catalog/includes/modules/kiss_meta_tags/classes/kiss_meta_tags_class.php on line 186

 

Warning: include_once() [function.include]: Failed opening 'catalog/includes/modules/kiss_meta_tags/modules/' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /catalog/includes/modules/kiss_meta_tags/classes/kiss_meta_tags_class.php on line 186

 

Fatal error: Class 'KissMT_Module' not found in /catalog/includes/modules/kiss_meta_tags/classes/kiss_meta_tags_class.php on line 187

 

Ive checked to see if I uploaded all the files in the right places. The files appear to be there

 

Help appreciated thanks

Share this post


Link to post
Share on other sites

Ive made a boo boo somewhere, Im running 2.3 & just installed the latest download. All works good except for when in checkout, I click "confirm order" I get this error on the checkout.php page

 

Nope I don't think you made a boo boo at all, in fact it is a good catch.

 

I had not expected any payment files to include template_top.php.

 

Try this ..

 

includes/modules/kiss_meta_tags/classes/kiss_meta_tags_class.php

 

Find ( line 141 ) ..

 

 	trigger_error( 'KissMT could not find a valid base filename, please inform the developer.', E_USER_WARNING );

 

Replace with ..

 

 

  	return (((strlen(ini_get('cgi.fix_pathinfo')) > 0) && ((bool)ini_get('cgi.fix_pathinfo') == false)) || !isset($HTTP_SERVER_VARS['SCRIPT_NAME'])) ? basename($HTTP_SERVER_VARS['PHP_SELF']) : basename($HTTP_SERVER_VARS['SCRIPT_NAME']);

Share this post


Link to post
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

×