[xwiki-users] strip accents from page name used in url
Hi, I’m using XWiki in Slovak language which uses accents, which consequently causes problems with urls. The urls becomes ugly containing encoded characters with accents. Does XWiki have integration point out of the box to replace the page name with custom one, with stripped accents from it? Thank you Mirec
Hi, does anyone have idea, how to automatically modify/generate url from page title so that the url doesn't contains accents or any special characters. I want to achieve simmilar approach used in CMS system Umbraco. Which creates url based on page title but strips spaces and any characters that requires url encoding. I've found xwiki.urlfactory.serviceclass in xwiki.cfg. What is responsibility of that class? What is it purpose? Can it be used to solve my requirement? Thanks Mirec On 11 July 2016 at 21:58, Miroslav Galajda <miroslav.galajda@gmail.com> wrote:
Hi, I’m using XWiki in Slovak language which uses accents, which consequently causes problems with urls. The urls becomes ugly containing encoded characters with accents. Does XWiki have integration point out of the box to replace the page name with custom one, with stripped accents from it?
Thank you
Mirec
Miroslav, are you sure that the issue is in XWiki? It's a very very very fragile topic but I think I can be done and it is considerably more elegant to have URLs that show the native language (I feel). Can you describe you're exact setup? A few hints from my experience: I've seen URLEncoding to be a tomcat context parameter (you want UTF8 I think, many had the bad habit of taking the platform encoding). Have you changed the platform encoding of XWiki? (the system properties) I've also had use of the "nocanon" option of Apache's RewriteRule. Changing the page-URL to remove accents would not be done in the URLFactory, it would be done in the page creation template. This would be the last bit I'd touch as it is multi-fold (e.g. you should start by using /xwiki/bin/edit/XÑü∂ß instead of /view/XÑü∂ß then click the buttons). Paul
Miroslav Galajda <mailto:miroslav.galajda@gmail.com> 6 September 2016 at 09:04 Hi, does anyone have idea, how to automatically modify/generate url from page title so that the url doesn't contains accents or any special characters. I want to achieve simmilar approach used in CMS system Umbraco. Which creates url based on page title but strips spaces and any characters that requires url encoding.
I've found xwiki.urlfactory.serviceclass in xwiki.cfg. What is responsibility of that class? What is it purpose? Can it be used to solve my requirement?
Thanks Mirec
On 11 July 2016 at 21:58, Miroslav Galajda <miroslav.galajda@gmail.com> _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users Miroslav Galajda <mailto:miroslav.galajda@gmail.com> 11 July 2016 at 21:58 Hi, I’m using XWiki in Slovak language which uses accents, which consequently causes problems with urls. The urls becomes ugly containing encoded characters with accents. Does XWiki have integration point out of the box to replace the page name with custom one, with stripped accents from it?
Thank you
Mirec _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Hi Miroslav,
On 06 Sep 2016, at 09:04, Miroslav Galajda <miroslav.galajda@gmail.com> wrote:
Hi, does anyone have idea, how to automatically modify/generate url from page title so that the url doesn't contains accents or any special characters. I want to achieve simmilar approach used in CMS system Umbraco. Which creates url based on page title but strips spaces and any characters that requires url encoding.
I've found xwiki.urlfactory.serviceclass in xwiki.cfg. What is responsibility of that class? What is it purpose? Can it be used to solve my requirement?
XWiki supports lots of languages out of the box (you just need to configure the encoding properly). Actually we’ve gone to great length to ensure that any character is valid in page and space names! :) May I ask why you would want to strip some characters? Now you shouldn’t act at the level of the URLs since the URLs are just used to find the corresponding document in XWiki. If you strip some char from the URL then you won’t be able to point a URL to an existing document anymore ;) So what you really want is instead to act at the level of document creation (the Add Page dialog box) and do the stripping there IMO. However ATM we don’t provide any extension point for doing this so you’d need to modify the corresponding vm file (create.vm I think, which calls other vms) and do future merges of that file by hand whenever you upgrade your XWiki instance in the future. I recommend to reconsider going in that direction and instead letting XWiki handle all chars. Thanks -Vincent
Thanks Mirec
On 11 July 2016 at 21:58, Miroslav Galajda <miroslav.galajda@gmail.com> wrote:
Hi, I’m using XWiki in Slovak language which uses accents, which consequently causes problems with urls. The urls becomes ugly containing encoded characters with accents. Does XWiki have integration point out of the box to replace the page name with custom one, with stripped accents from it?
Thank you
Mirec
On 06 Sep 2016, at 09:22, Vincent Massol <vincent@massol.net> wrote:
Hi Miroslav,
On 06 Sep 2016, at 09:04, Miroslav Galajda <miroslav.galajda@gmail.com> wrote:
Hi, does anyone have idea, how to automatically modify/generate url from page title so that the url doesn't contains accents or any special characters. I want to achieve simmilar approach used in CMS system Umbraco. Which creates url based on page title but strips spaces and any characters that requires url encoding.
I've found xwiki.urlfactory.serviceclass in xwiki.cfg. What is responsibility of that class? What is it purpose? Can it be used to solve my requirement?
XWiki supports lots of languages out of the box (you just need to configure the encoding properly).
On this the doc is at http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Encoding Thanks -Vincent
Actually we’ve gone to great length to ensure that any character is valid in page and space names! :)
May I ask why you would want to strip some characters?
Now you shouldn’t act at the level of the URLs since the URLs are just used to find the corresponding document in XWiki. If you strip some char from the URL then you won’t be able to point a URL to an existing document anymore ;)
So what you really want is instead to act at the level of document creation (the Add Page dialog box) and do the stripping there IMO.
However ATM we don’t provide any extension point for doing this so you’d need to modify the corresponding vm file (create.vm I think, which calls other vms) and do future merges of that file by hand whenever you upgrade your XWiki instance in the future.
I recommend to reconsider going in that direction and instead letting XWiki handle all chars.
Thanks -Vincent
Thanks Mirec
On 11 July 2016 at 21:58, Miroslav Galajda <miroslav.galajda@gmail.com> wrote:
Hi, I’m using XWiki in Slovak language which uses accents, which consequently causes problems with urls. The urls becomes ugly containing encoded characters with accents. Does XWiki have integration point out of the box to replace the page name with custom one, with stripped accents from it?
Thank you
Mirec
Hi, yes I'm aware of the encoding problems with urls in Tomcat certain versions. This is not my problem. My urls are displaying OK, depending on browser. Chrome is displaying decoded urls but IE is not decoding urls, and it displays url in it's original form with url encoded characters. For example, when I create a page with name "Čučoriedky - Blueberries" I'll get this url http://wiki/test-xwiki/view/Sandbox/%C4%8Cu%C4%8Doriedky+- +Blueberries/. But when using chrome, the chrome displays it decoded, which displays nice, but when you copy the link, it is still encoded. The IE is not decoding URL, so in IE the url looks in address bar ugly. When you explicitly navigate to decoded url, "http://wiki/test-xwiki/view/ Sandbox/Čučoriedky - Blueberries/" it works as expected. So I think I have configured URL encoding correctly and I have followed the http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Encoding. I've attached screenshots to see what I'm talking about. Best regards Mirec On 6 September 2016 at 09:14, Paul Libbrecht <paul@hoplahup.net> wrote:
Miroslav,
are you sure that the issue is in XWiki? It's a very very very fragile topic but I think I can be done and it is considerably more elegant to have URLs that show the native language (I feel).
Can you describe you're exact setup?
A few hints from my experience: I've seen URLEncoding to be a tomcat context parameter (you want UTF8 I think, many had the bad habit of taking the platform encoding). Have you changed the platform encoding of XWiki? (the system properties) I've also had use of the "nocanon" option of Apache's RewriteRule.
Changing the page-URL to remove accents would not be done in the URLFactory, it would be done in the page creation template. This would be the last bit I'd touch as it is multi-fold (e.g. you should start by using /xwiki/bin/edit/XÑü∂ß instead of /view/XÑü∂ß then click the buttons).
Paul
Miroslav Galajda <mailto:miroslav.galajda@gmail.com> 6 September 2016 at 09:04 Hi, does anyone have idea, how to automatically modify/generate url from page title so that the url doesn't contains accents or any special characters. I want to achieve simmilar approach used in CMS system Umbraco. Which creates url based on page title but strips spaces and any characters that requires url encoding.
I've found xwiki.urlfactory.serviceclass in xwiki.cfg. What is responsibility of that class? What is it purpose? Can it be used to solve my requirement?
Thanks Mirec
On 11 July 2016 at 21:58, Miroslav Galajda <miroslav.galajda@gmail.com> _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users Miroslav Galajda <mailto:miroslav.galajda@gmail.com> 11 July 2016 at 21:58 Hi, I’m using XWiki in Slovak language which uses accents, which consequently causes problems with urls. The urls becomes ugly containing encoded characters with accents. Does XWiki have integration point out of the box to replace the page name with custom one, with stripped accents from it?
Thank you
Mirec _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Hi Vincent, yes the stripping would occure at the document creating time, or when renaming the page. The workarround for this would be to have the user always think that when creating the new page, enter the name without accents and without spaces and consequently change the page title to a desired name. Other way is to go to the rename page action, and there carrefully change the page name and not page title, this is little tricky. The main reason for this is that the encoded urls looks ugly when sharing it and copying directly to clipboard it out of the xwiki. On 6 September 2016 at 09:22, Vincent Massol <vincent@massol.net> wrote:
Hi Miroslav,
On 06 Sep 2016, at 09:04, Miroslav Galajda <miroslav.galajda@gmail.com> wrote:
Hi, does anyone have idea, how to automatically modify/generate url from page title so that the url doesn't contains accents or any special characters. I want to achieve simmilar approach used in CMS system Umbraco. Which creates url based on page title but strips spaces and any characters that requires url encoding.
I've found xwiki.urlfactory.serviceclass in xwiki.cfg. What is responsibility of that class? What is it purpose? Can it be used to solve my requirement?
XWiki supports lots of languages out of the box (you just need to configure the encoding properly). Actually we’ve gone to great length to ensure that any character is valid in page and space names! :)
May I ask why you would want to strip some characters?
Now you shouldn’t act at the level of the URLs since the URLs are just used to find the corresponding document in XWiki. If you strip some char from the URL then you won’t be able to point a URL to an existing document anymore ;)
So what you really want is instead to act at the level of document creation (the Add Page dialog box) and do the stripping there IMO.
However ATM we don’t provide any extension point for doing this so you’d need to modify the corresponding vm file (create.vm I think, which calls other vms) and do future merges of that file by hand whenever you upgrade your XWiki instance in the future.
I recommend to reconsider going in that direction and instead letting XWiki handle all chars.
Thanks -Vincent
Thanks Mirec
On 11 July 2016 at 21:58, Miroslav Galajda <miroslav.galajda@gmail.com> wrote:
Hi, I’m using XWiki in Slovak language which uses accents, which consequently causes problems with urls. The urls becomes ugly containing encoded characters with accents. Does XWiki have integration point out of the box to replace the page name with custom one, with stripped accents from it?
Thank you
Mirec
_______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
On 06 Sep 2016, at 10:19, Miroslav Galajda <miroslav.galajda@gmail.com> wrote:
Hi Vincent, yes the stripping would occure at the document creating time, or when renaming the page.
The workarround for this would be to have the user always think that when creating the new page, enter the name without accents and without spaces and consequently change the page title to a desired name. Other way is to go to the rename page action, and there carrefully change the page name and not page title, this is little tricky.
The main reason for this is that the encoded urls looks ugly when sharing it and copying directly to clipboard it out of the xwiki.
ok that’s something for which I’d like to provide some option for. Some ideas: * Introduce the concept of alias, i.e. be able to have different URLs pointing to the same document/page. Thus for example if you have some long URL such as http://mywiki/…/page1/page2/…/pageN you would be able to create an alias such as http://mywiki/…/MyNicePage and share it outside of XWiki. This is http://design.xwiki.org/xwiki/bin/view/Proposal/DocumentAliases * Introduce an extension that generates tinyurl-like URLs for any page and that you can share (optionally allow the user to specify a suffix to make the url recognizable, same as on http://tinyurl.com/). Basically this is the same as using directly http://tinyurl.com/ but easier for the user since he’d be able to get the URL directly from the xwiki UI somewhere. Now I think it would be nice to offer an extension point in the Create dialog box so that it can be extended safely and be used to transform the input of the user (remove special chars, automatically append some text, etc). This would be the first step. Second step could be to offer a sanitize feature that could be configured in the Admin, using this mechanism (it would be off by default). IMO you could create a jira issue for this. Thanks -Vincent
On 6 September 2016 at 09:22, Vincent Massol <vincent@massol.net> wrote:
Hi Miroslav,
On 06 Sep 2016, at 09:04, Miroslav Galajda <miroslav.galajda@gmail.com> wrote:
Hi, does anyone have idea, how to automatically modify/generate url from page title so that the url doesn't contains accents or any special characters. I want to achieve simmilar approach used in CMS system Umbraco. Which creates url based on page title but strips spaces and any characters that requires url encoding.
I've found xwiki.urlfactory.serviceclass in xwiki.cfg. What is responsibility of that class? What is it purpose? Can it be used to solve my requirement?
XWiki supports lots of languages out of the box (you just need to configure the encoding properly). Actually we’ve gone to great length to ensure that any character is valid in page and space names! :)
May I ask why you would want to strip some characters?
Now you shouldn’t act at the level of the URLs since the URLs are just used to find the corresponding document in XWiki. If you strip some char from the URL then you won’t be able to point a URL to an existing document anymore ;)
So what you really want is instead to act at the level of document creation (the Add Page dialog box) and do the stripping there IMO.
However ATM we don’t provide any extension point for doing this so you’d need to modify the corresponding vm file (create.vm I think, which calls other vms) and do future merges of that file by hand whenever you upgrade your XWiki instance in the future.
I recommend to reconsider going in that direction and instead letting XWiki handle all chars.
Thanks -Vincent
Thanks Mirec
On 11 July 2016 at 21:58, Miroslav Galajda <miroslav.galajda@gmail.com> wrote:
Hi, I’m using XWiki in Slovak language which uses accents, which consequently causes problems with urls. The urls becomes ugly containing encoded characters with accents. Does XWiki have integration point out of the box to replace the page name with custom one, with stripped accents from it?
Thank you
Mirec
Hi, this is nice proposal, but I think this is just another workarround. It is not directly solving the problem and user have to think about it, when sharing the url. It is not straightforward and requires the user to work differently with urls in xwiki, different when browsing the other web sites. I would not force the user to think/to behave differently in xwiki. Please think about it. How you work with urls, you just simple copy and paste it to email, chat or other applications. The better would be to have url to be stripped out of the special url non-friendly characters when creating or renaming the page and you don't have to care about special handling urls after that. This is more suitable solution as it doesn't force the user to care about how to name the page or how to share the page. I hope you will have simmilar view on the matter. Best regards Mirec On 6 September 2016 at 10:45, Vincent Massol <vincent@massol.net> wrote:
On 06 Sep 2016, at 10:19, Miroslav Galajda <miroslav.galajda@gmail.com> wrote:
Hi Vincent, yes the stripping would occure at the document creating time, or when renaming the page.
The workarround for this would be to have the user always think that when creating the new page, enter the name without accents and without spaces and consequently change the page title to a desired name. Other way is to go to the rename page action, and there carrefully change the page name and not page title, this is little tricky.
The main reason for this is that the encoded urls looks ugly when sharing it and copying directly to clipboard it out of the xwiki.
ok that’s something for which I’d like to provide some option for.
Some ideas:
* Introduce the concept of alias, i.e. be able to have different URLs pointing to the same document/page. Thus for example if you have some long URL such as http://mywiki/…/page1/page2/…/pageN you would be able to create an alias such as http://mywiki/…/MyNicePage and share it outside of XWiki. This is http://design.xwiki.org/xwiki/bin/view/Proposal/ DocumentAliases
* Introduce an extension that generates tinyurl-like URLs for any page and that you can share (optionally allow the user to specify a suffix to make the url recognizable, same as on http://tinyurl.com/). Basically this is the same as using directly http://tinyurl.com/ but easier for the user since he’d be able to get the URL directly from the xwiki UI somewhere.
Now I think it would be nice to offer an extension point in the Create dialog box so that it can be extended safely and be used to transform the input of the user (remove special chars, automatically append some text, etc). This would be the first step. Second step could be to offer a sanitize feature that could be configured in the Admin, using this mechanism (it would be off by default).
IMO you could create a jira issue for this.
Thanks -Vincent
On 6 September 2016 at 09:22, Vincent Massol <vincent@massol.net> wrote:
Hi Miroslav,
On 06 Sep 2016, at 09:04, Miroslav Galajda <miroslav.galajda@gmail.com
wrote:
Hi, does anyone have idea, how to automatically modify/generate url
from
page title so that the url doesn't contains accents or any special characters. I want to achieve simmilar approach used in CMS system Umbraco. Which creates url based on page title but strips spaces and any characters that requires url encoding.
I've found xwiki.urlfactory.serviceclass in xwiki.cfg. What is responsibility of that class? What is it purpose? Can it be used to solve my requirement?
XWiki supports lots of languages out of the box (you just need to configure the encoding properly). Actually we’ve gone to great length to ensure that any character is valid in page and space names! :)
May I ask why you would want to strip some characters?
Now you shouldn’t act at the level of the URLs since the URLs are just used to find the corresponding document in XWiki. If you strip some char from the URL then you won’t be able to point a URL to an existing document anymore ;)
So what you really want is instead to act at the level of document creation (the Add Page dialog box) and do the stripping there IMO.
However ATM we don’t provide any extension point for doing this so you’d need to modify the corresponding vm file (create.vm I think, which calls other vms) and do future merges of that file by hand whenever you upgrade your XWiki instance in the future.
I recommend to reconsider going in that direction and instead letting XWiki handle all chars.
Thanks -Vincent
Thanks Mirec
On 11 July 2016 at 21:58, Miroslav Galajda <miroslav.galajda@gmail.com
wrote:
Hi, I’m using XWiki in Slovak language which uses accents, which consequently causes problems with urls. The urls becomes ugly containing encoded characters with accents. Does XWiki have integration point out of the box to replace the page name with custom one, with stripped accents from it?
Thank you
Mirec
_______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Hi, I'm asking for help again. I need to globally override how the names for documents are created. By design/default the name is taken from title 1:1, which user enters when she creates the page. I would like to have url friendly names. How can I achieve this? Overriding some component or what? I noticed that for example FAQ application enables to create FAQs using their UI with some code-behind, which uses this two lines of code: #set ($newFAQReference = $services.model.createDocumentReference('', '', "$question")) $response.sendRedirect($xwiki.getURL($newFAQReference, 'inline', "$!{request.queryString}&title=${escapetool.url($question)}")) There are two options, either override createDocumentReference or override the $xwiki.getUrl() method. This would probably solve all points, where is some logic with creating pages. Thanks Best regards Miroslav Galajda On 6 September 2016 at 11:01, Miroslav Galajda <miroslav.galajda@gmail.com> wrote:
Hi, this is nice proposal, but I think this is just another workarround. It is not directly solving the problem and user have to think about it, when sharing the url. It is not straightforward and requires the user to work differently with urls in xwiki, different when browsing the other web sites.
I would not force the user to think/to behave differently in xwiki. Please think about it. How you work with urls, you just simple copy and paste it to email, chat or other applications. The better would be to have url to be stripped out of the special url non-friendly characters when creating or renaming the page and you don't have to care about special handling urls after that. This is more suitable solution as it doesn't force the user to care about how to name the page or how to share the page. I hope you will have simmilar view on the matter.
Best regards Mirec
On 6 September 2016 at 10:45, Vincent Massol <vincent@massol.net> wrote:
On 06 Sep 2016, at 10:19, Miroslav Galajda <miroslav.galajda@gmail.com> wrote:
Hi Vincent, yes the stripping would occure at the document creating time, or when renaming the page.
The workarround for this would be to have the user always think that when creating the new page, enter the name without accents and without spaces and consequently change the page title to a desired name. Other way is to go to the rename page action, and there carrefully change the page name and not page title, this is little tricky.
The main reason for this is that the encoded urls looks ugly when sharing it and copying directly to clipboard it out of the xwiki.
ok that’s something for which I’d like to provide some option for.
Some ideas:
* Introduce the concept of alias, i.e. be able to have different URLs pointing to the same document/page. Thus for example if you have some long URL such as http://mywiki/…/page1/page2/…/pageN you would be able to create an alias such as http://mywiki/…/MyNicePage and share it outside of XWiki. This is http://design.xwiki.org/xwiki/ bin/view/Proposal/DocumentAliases
* Introduce an extension that generates tinyurl-like URLs for any page and that you can share (optionally allow the user to specify a suffix to make the url recognizable, same as on http://tinyurl.com/). Basically this is the same as using directly http://tinyurl.com/ but easier for the user since he’d be able to get the URL directly from the xwiki UI somewhere.
Now I think it would be nice to offer an extension point in the Create dialog box so that it can be extended safely and be used to transform the input of the user (remove special chars, automatically append some text, etc). This would be the first step. Second step could be to offer a sanitize feature that could be configured in the Admin, using this mechanism (it would be off by default).
IMO you could create a jira issue for this.
Thanks -Vincent
On 6 September 2016 at 09:22, Vincent Massol <vincent@massol.net> wrote:
Hi Miroslav,
On 06 Sep 2016, at 09:04, Miroslav Galajda < miroslav.galajda@gmail.com> wrote:
Hi, does anyone have idea, how to automatically modify/generate url from page title so that the url doesn't contains accents or any special characters. I want to achieve simmilar approach used in CMS system Umbraco. Which creates url based on page title but strips spaces and any characters that requires url encoding.
I've found xwiki.urlfactory.serviceclass in xwiki.cfg. What is responsibility of that class? What is it purpose? Can it be used to solve my requirement?
XWiki supports lots of languages out of the box (you just need to configure the encoding properly). Actually we’ve gone to great length to ensure that any character is valid in page and space names! :)
May I ask why you would want to strip some characters?
Now you shouldn’t act at the level of the URLs since the URLs are just used to find the corresponding document in XWiki. If you strip some char from the URL then you won’t be able to point a URL to an existing document anymore ;)
So what you really want is instead to act at the level of document creation (the Add Page dialog box) and do the stripping there IMO.
However ATM we don’t provide any extension point for doing this so you’d need to modify the corresponding vm file (create.vm I think, which calls other vms) and do future merges of that file by hand whenever you upgrade your XWiki instance in the future.
I recommend to reconsider going in that direction and instead letting XWiki handle all chars.
Thanks -Vincent
Thanks Mirec
On 11 July 2016 at 21:58, Miroslav Galajda < miroslav.galajda@gmail.com> wrote:
Hi, I’m using XWiki in Slovak language which uses accents, which consequently causes problems with urls. The urls becomes ugly containing encoded characters with accents. Does XWiki have integration point out of the box to replace the page name with custom one, with stripped accents from it?
Thank you
Mirec
_______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
participants (3)
-
Miroslav Galajda -
Paul Libbrecht -
Vincent Massol