Keyword

Replace space by dash in K2 Tags

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
3 years 7 months ago #178491 by Goble002
Replace space by dash in K2 Tags was created by Goble002
Hello,

This issue has been raised several times here but haven't found the solution yet.

I have tags with 2 words for my k2 items. I cannot create menu items for these tags (since there are 100s of them). From a previous post:

You can't have spaces in URLs. K2 converts spaces to the appropriate characters according to the URL specification  www.ietf.org/rfc/rfc1738.txt . Then it's up to the browser you are using to convert them back and display them correctly. Most modern browsers do that.

I understand that browsers have different behaviours :
  1. Chrome : URL shown on item page (when hovered) : "mysite.com/photos/itemlist/tag/Test Tag" but will load: "mysite.com/photos/itemlist/tag/Test%20Tag"
  2. Edge : URL shown on item page (when hovered) and will load : "mysite.com/photos/itemlist/tag/Test%20Tag"
  3. FireFox : URL shown on item page (when hovered) and will load : "mysite.com/photos/itemlist/tag/Test Tag"
I've heard that "%20" is not considered as SEF by Google.

In "Enforce SEF URL character replacements", possible to convert space with dash ? I tried following but it won't work: "%20|-" and " |-"

Have tried below from StackOverflow but no success:
# remove spaces from start or after / RewriteRule ^(.*/|)[\s%20]+(.+)$ $1$2 [L] # remove spaces from end or before / RewriteRule ^(.+?)[\s%20]+(/.*|)$ $1$2 [L] # replace spaces by - in between RewriteRule ^([^\s%20]*)(?:\s|%20)+(.*)$ $1-$2 [L,R]

Any help will be much appreciated.
 

Please Log in or Create an account to join the conversation.

More
3 years 7 months ago #178498 by JoomlaWorks
Replied by JoomlaWorks on topic Replace space by dash in K2 Tags
Sure, try "Enforce SEF URL character replacements" first. On the other hand, if you make distinct menu items, then you can create your own URL alias, in which case you can of course insert a dash between a tag's words.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
3 years 7 months ago #178503 by Goble002
Replied by Goble002 on topic Replace space by dash in K2 Tags
Hi and thanks Fotis,

Like explained, I've tried "Enforce SEF URL character replacements". It's simply not working for me.
"Enforce SEF URL character replacements" > Yes

The default values in "SEF URL character replacements" are not doing anything, For example : tag "Àtest" is not being converted to "Atest".

I have disabled .htaccess, disable/enable SEF (just below). I have tried another joomla site (completely different): no luck as well. So could not be an extension conflict.

However for Joomla articles, tags with "Àtest" are converted to "Atest". 

Extract from Joomla documentation

"In Joomla!, each component is responsible for handling its own SEF URLs. Therefore, as the developer of a component, you will have to create your own router to allow your component to use SEF URLs."

So Joomla Core will not help here.


Fotis wrote :

"On the other hand, if you make distinct menu items, then you can create your own URL alias, in which case you can of course insert a dash between a tag's words."

>> Like explained I can't afford to have menu item for the k2 tags.


 

Please Log in or Create an account to join the conversation.

More
3 years 7 months ago #178507 by JoomlaWorks
Replied by JoomlaWorks on topic Replace space by dash in K2 Tags
Have you added the relevant K2 language pack?

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
3 years 7 months ago #178511 by Goble002
Replied by Goble002 on topic Replace space by dash in K2 Tags
Hi,

No. I was taking "À "as an example.

These are my 4 last entries:
ӭ|e, ю|yu, я|ya, |-, %20|-

Please Log in or Create an account to join the conversation.

More
3 years 7 months ago #178513 by JoomlaWorks
Replied by JoomlaWorks on topic Replace space by dash in K2 Tags
Yes, but my question still stands. You need the relevant K2 language pack for filters to work.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
3 years 7 months ago #178516 by Goble002
Replied by Goble002 on topic Replace space by dash in K2 Tags
Hi Fotis,

I would be glad to install whatever language pack required. My site is only in English. My issue is about the space in the URL. See my original post.

Please Log in or Create an account to join the conversation.

More
3 years 7 months ago #178520 by JoomlaWorks
Replied by JoomlaWorks on topic Replace space by dash in K2 Tags
You need to add a language pack in Joomla for sure with a language that handles these special characters. Then and only then can Joomla (and K2) perform any such character replacements.

See this: docs.joomla.org/International_Enhancements_for_Version_1.6#Custom_Transliteration_Support

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
3 years 7 months ago #178525 by Goble002
Replied by Goble002 on topic Replace space by dash in K2 Tags
Hi and thanks Fotis,

really appreciate your help on this. However may be I wrongly expressed myself and as such we are going in the wrong direction.

You need to add a language pack in Joomla for sure with a language that handles these special characters.

I need to remove a space from the URL (Space resulting from a 2 word tag example "test tag") . Then what would be the language pack which should handle special characters like space ? The space is my only issue. I don't have any other characters to be replaced.

Then and only then can Joomla (and K2) perform any such character replacements.

Like explained earlier, Joomla is removing automatically spaces from URL (Tag listing for Joomla Articles) for tags with a space like "test tag".

Please Log in or Create an account to join the conversation.

  • Goble002
  • Goble002's Avatar Topic Author
  • Offline
  • Premium Member
More
3 years 7 months ago #178580 by Goble002
Replied by Goble002 on topic Replace space by dash in K2 Tags
Hi Fotis,

any thoughts on this will be highly appreciated.

Am stuck with publishing my website because of search engines indexing / sharing links that might no longer exist.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum