Document name/url generation

24 views
Skip to first unread message

Dennis Vonk

unread,
Dec 5, 2016, 7:56:47 AM12/5/16
to Hippo Community
Hi,

I am trying to make a utility method usable in Freemarker that generates a string like Hippo does when creating a document and using that in the url. That means:
  • replacing all special characters like 'ç' and 'é' to the default value 'c' and 'e'
  • replacing all other characters like spaces and questionmarks etc with a '-'
  • all to lowercase
Examples:
  • 3 - Waarom heb ik nog geen Pakketkorting van Univé ontvangen?
  • 3---waarom-heb-ik-nog-geen-pakketkorting-van-unive-ontvangen

I have been looking inside Hippo code but couldn't find where this functionality is located.

P.S. We use Hippo 10.2.2

Woonsan Ko

unread,
Dec 5, 2016, 9:34:00 AM12/5/16
to hippo-c...@googlegroups.com
Maybe you con consider using org.hippoecm.repository.api.StringCodecFactory.UriEncoding class (in hippo-repository-api jar) to create a custom JSTL function and use it in ftl.

    StringCodec codec = new StringCodecFactory.UriEncoding();
    String encodedUrl = codec.encode(url);

HTH,

Woonsan


--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-community@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.



--
Boston - 745 Atlantic Ave, 8th Floor, Boston MA 02111
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466

Dennis Vonk

unread,
Dec 5, 2016, 9:38:35 AM12/5/16
to Hippo Community
On the interweb I found this for a temp solution, which works rather good but doesn't look like a 100% match with Hippo SEO friendly url.

Woonsan Ko

unread,
Dec 5, 2016, 9:42:30 AM12/5/16
to hippo-c...@googlegroups.com
StringCodecFactory.UriEncoding should be better and more consistent since it's used internally by hippo product.

Regards,

Woonsan


--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-community@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.

Dennis Vonk

unread,
Dec 5, 2016, 9:45:37 AM12/5/16
to Hippo Community
Hi Woonsan, 

I agree with your last remark. So I marked your solution as the final answer and using that in my project.
I already created a custom JSTL function, but needed the correct code.

So thanks for that!
Reply all
Reply to author
Forward
0 new messages