typo3-realurl icon indicating copy to clipboard operation
typo3-realurl copied to clipboard

Unique alias on a per language basis

Open eliademoga opened this issue 7 years ago • 8 comments

Hello,

I work on a multi language site with separate domains for each language. The realurl_conf.php file is setup accordingly using '_DOMAINS'. The site presents articles in list and detail view using a custom extension and each article has the same title for all it's translations. So, the unique aliases are built like this:

  • the article is called "Albertus 27";
  • the base language uniqalias would be "albertus-27";
  • one translation's uniqalias would be "albertus-27-1" (because of the needed uniqueness of aliases);
  • another translation's uniqalias would be "albertus-27-2";
  • each of these records above are stored by language in the tx_realurl_uniqualias table.

This is because, at this time, the cached alias existence is checked per language, but it's uniqueness is checked regardless of language and this of course may be the proper behavior of the extension. So far so good.

However, the client's request is to not use URLs having '-1' at the end of the translation's alias, but to use the same alias path segment for each language.

By going through the code, I found that the check for the alias uniqueness could be done by language by passing the language uid to some of the methods and use it when the uniqueness is checked. I made a custom extension to extend realurl's functionality in order to achieve this on the project.

Questions: Can this be a useful improvement for the behavior of the realurl extension and be integrated in it's code in the future? If yes, I can contribute and do it myself.

Looking forward to your reply, Cristian Moga

eliademoga avatar Nov 14 '16 10:11 eliademoga

Hi,

Same issue here. Created a thread some time ago in the Typo3 Forum: https://forum.typo3.org/index.php?t=tree&goto=744974&#msg_744974.

Hopefully this could be implemented soon. I might do it and create a pull request.

Greetings Gion

gionkoch avatar Jan 27 '17 16:01 gionkoch

@eliademoga Could you please share your solution so that we could work this into a pull request?

pixelbrackets avatar May 15 '17 12:05 pixelbrackets

@eliademoga I also would like to use your extension to have it working like you described. Thank you

@dmitryd Is it planned to add this feature in the near future?

gessulatgessulat avatar Dec 05 '17 16:12 gessulatgessulat

Hello,

please find attached the extension I used to alter the normal realurl behavior for encoding / decoding unique aliases. The classes extend the realurl 2.1.4 UrlEncoder and UrlDecoder classes. Basically I added the $languageUid parameter to some methods that previously didn't use it in order to use it in the sql WHERE clauses. I also added it to the calls for those methods. Obviously :P Let me know if you need anything else.

Best regards,

Cristi Moga

On Tue, Dec 5, 2017 at 6:48 PM, gessulatgessulat [email protected] wrote:

@eliademoga https://github.com/eliademoga I also would like to use your extension to have it working like you described. Thank you

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dmitryd/typo3-realurl/issues/326#issuecomment-349365677, or mute the thread https://github.com/notifications/unsubscribe-auth/AWXHLvw767H6rEBJ0dmWzTsNWz61qJ6uks5s9XPygaJpZM4KxJEz .

eliademoga avatar Dec 07 '17 17:12 eliademoga

Hi Steffen,

the fact is I attached the file, but for some reason it got filtered. Maybe it's because we communicate through the realurl issue tracker. Please check if the archive is visible on your side through google docs: https://drive.google.com/file/d/12aZe7TMfxQ84_Uj2WxWggiwxZSuqQa72/view?usp=sharing

Alles gute! Best regards,

Cristi Moga

On Fri, Dec 8, 2017 at 11:47 AM, gessulatgessulat [email protected] wrote:

Hi,

thanks for your reply and providing us your extension fix. Unfortunatly there is no attachment in the e-mail.

Could you please sent again?

Kind regards,

Steffen Thiede

2017-12-07 18:38 GMT+01:00 eliademoga [email protected]:

Hello,

please find attached the extension I used to alter the normal realurl behavior for encoding / decoding unique aliases. The classes extend the realurl 2.1.4 UrlEncoder and UrlDecoder classes. Basically I added the $languageUid parameter to some methods that previously didn't use it in order to use it in the sql WHERE clauses. I also added it to the calls for those methods. Obviously :P Let me know if you need anything else.

Best regards,

Cristi Moga

On Tue, Dec 5, 2017 at 6:48 PM, gessulatgessulat < [email protected]

wrote:

@eliademoga https://github.com/eliademoga I also would like to use your extension to have it working like you described. Thank you

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <https://github.com/dmitryd/typo3-realurl/issues/326# issuecomment-349365677>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ AWXHLvw767H6rEBJ0dmWzTsNWz61qJ6uks5s9XPygaJpZM4KxJEz> .

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/dmitryd/typo3-realurl/issues/326# issuecomment-350040597>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AO43p_ InNRY5LZmgJrYZpD7X3S3XjLj7ks5s-CKWgaJpZM4KxJEz> .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dmitryd/typo3-realurl/issues/326#issuecomment-350220560, or mute the thread https://github.com/notifications/unsubscribe-auth/AWXHLvXTMU2mhZ8LhFRTOucVNGtebjv1ks5s-QW8gaJpZM4KxJEz .

eliademoga avatar Dec 08 '17 13:12 eliademoga

Guys, please, communicate directly, ok?

dmitryd avatar Jan 05 '18 09:01 dmitryd

Works for me as described.

audef1 avatar Apr 23 '18 11:04 audef1

Will this be merged?

alexthunder3 avatar Oct 17 '19 14:10 alexthunder3