Forum OpenACS Development: Re: SEO friendly urls

11: Re: SEO friendly urls (response to 10)
Posted by Gustaf Neumann on
a few comments:

- the snipped above was intended for a .vuh handler
- "very dynamic": note that you get bad ratings on frequently changing URLs when other people use make links to your content, and you change the URL pointing to the same content (without a redirect)
- "title" has has well bad internationalization aspects (depending on the language settings, a link might work or not, ... when e.g. a user is logged out or logged in)
- why is there a bug in the code snipped above? as indicated in the comments, your code has to handle the case that a look up returns multiple (or no) results. The code snipped hat the purpose to show you a way out of the scalability problem of your previous approaches.
- why should ns_return be mandatory? mandatory for what?
- don't use manual URL splitting, but the API

12: Re: SEO friendly urls (response to 11)
Posted by Iuri Sampaio on
Hi Gustaf, Thanks for the tips.
I've amended the source code in order to use name instead of title. (ie. by the time the item gets inserted.) That way, we don't harm SEO statistics.

One thing, though, is that, in the long term, a user may change the title of the item, then the URL becomes different from the actual title, causing a bad user/public experience
(i.e. the public will browse the item's page, and they will see that the URL is slightly, or very, different from the actual title.

But that's perfectionism, I'd say. So, I created a scheduled script to update the name of the item,once in a while.
That way SEO URL won't change too often, meaning every time a user changes item's title. But only when the script runs.

Plus, I've made a few enhancements to util_text_to_url in order to switch Latin accentuated letters to their actual/root letters, instead of hyphen symbol "-".

set name [util_text_to_url [string map {á a à a â a ã a ç c é e è e ê e í i ó o õ o ô o ú u "´" "" "'" "" " " - "," -} [string tolower $title]]]

Best wishes,