Welcome Guest, Not a member yet? Register   Sign In
Shorten Library (for implementing rev="canonical"/rel="shortlink")
#1

[eluser]allmarkedup[/eluser]
Hi guys,

Just to let you know that I have just put together a little library for implementing local short URL creation for any CI projects. From the docs:

The Shorten library provides a quick and easy way to implement self-hosted 'short URLs' (and add the appropriate <code>rev="canonical"</code> / <code>rel="shortlink"</code> elements into your pages) on your CodeIgniter-powered site. You can implement it with just a few lines of code and use hand-crafted short versions of your URLs, let the class auto-shorten them, or use a mix of both approaches.

These is more info here: http://projects.allmarkedup.com/codeigni...n_library/

Hope you like it! Any problems let me know, I will get a blog post up about it soon and you can add comments there or just post bug reports/feature requests here. It's been put together pretty quickly so any suggestions are welcome.
#2

[eluser]xwero[/eluser]
It's a bit strange to create a library for something that is just an idea from someone.

I'm in the let-twitter-handle-the-url-shortening-themselves camp, which makes url shortener services obsolete.

If you really want to have your own short urls why not use, next to a permalink, a twitterlink.
#3

[eluser]allmarkedup[/eluser]
xwero - This has nothing to do with Twitter really - obviously you can use the links generated in your twitter messages, but short urls are useful in many situations.

The library basically intends to make it easy to create custom short urls that you can use anywhere, and prevents reliance on any third party provider to keep those URLs working. It's all in your hands - you may like that or not!

As for the rev="canonical"/rel="shortlink" being just an idea at the moment - it is indeed, but is being adopted at a fast pace across the net as a way to combat the inevitable problem of linkrot should the third party URL shorteners go bust.

This library doesn't even require you to include the rev="canonical"/rel="shortlink" &lt;link&gt; element on the site if you don't want to - just use it to easily create short URLs for your own use should you wish.
#4

[eluser]xwero[/eluser]
The only situation i can think of where a short url can be useful is when you browse to a specific link on a mobile phone by typing the url, but who does that? Can you give examples of the situations short urls are useful?

The problem with short urls is that is devalues the urls where you carefully added keywords to. I followed the whole discussion and my question still is how many developers will get the feeling SEO doesn't count anymore?
The keywords also have effect on the way users search their visited links.

It simple and it requires less data storage to just use the id instead of a slug. This already shortens your url from site.com/blog/title-with-keywords to site.com/blog/233. With routing developers already create short urls to the parts that they want to get the most eyeballs.

If the domain is www.my-wonderful-company-name.com your library is not going to do much good because that needs to be shortened too if you want twitters to use it. In the canonical discussion people suggested to buy a shorter domain for long domains but are you willing to go that far to create a short url?

I'm sorry i use your thread as a way to vent my thoughts on the subject but i think people get scared by the whole discussion they are going to do things that aren't needed. The mentioning of canonical has given your library bad points in my eyes. Of course everyone is free to use what they want.
#5

[eluser]allmarkedup[/eluser]
xwero - vent away! :-) I do understand your view point, but I can't see that using an ID rather than a slug is an improvement SEO-wise? You still loose all your nice keywords...

Most of what this library can be achieved using routing - but the library provides a nice way way to manage things, and personally I think the routing file should be for core functionality only. This keeps the additional short URLs separate from that core functionality.

These URLs are not intended to replace the full URLs at all - they are just an additional, shorter way of accessing the content. They all use a 301 redirect to the full URL to be as friendly to search engines as possible.

I give out URLs all over the phone to clients regularly, and shortened URLs are much easier for that. And other people may want to use shortened URLs of your pages, even if you don't! Obviously if you have a very long domain name then it is not that helpful for services such as twitter, but most people have reasonable length domains in reality.

For instance, on my site, I have a post at http://allmarkedup.com/archives/some-int...-projects/. Hard to fit in a tweet! But if I used http://allmarkedup.com/sijp (doesn't actually work...!) then that is much more do-able, even without a shorter domain name. And I am in control of it!

Personally, I can't see how it is not an advantage to be able to self-host short URL versions of your pages, rather than rely on 3rd party URL shorteners? You can craft them yourself, and if the shortening service goes bust you are not left with a bunch of links that no longer point to your site. If the rel="shortlink" (or whatever) is widely adopted, then the power (and responsibility) for handling shortened URLs is in the hands of the site owner, where I think it should be.

URL shortening is not going to go away - and I think that in light of that it makes sense to work towards a situation where the site owners have at least some say over the way their pages are accessed.

Always good to get an opposing view though! Smile
#6

[eluser]xwero[/eluser]
I have no problem with hosting your own short urls but how you make your visitors aware you have short urls. That was the job of the twitterlink i mentioned in my first response, it could be named more generic shortlink if you want.

Using the id instead of a slug is an example on how developers can keep the url short. It doesn't matter what you use as a short url because it going to 301 redirected anyway. For people it's easier to remember and id than a slug. You can trick spiders and only redirect them to a slug url. But then you let people stand in the cold that use the key words to search a page on your site in their locationbar, they have to use a search engine then.

When the site has a well thought out url architecture the urls that people are most likely going to hack will have a short base site.com/blog is never going to be site.com/vendor/module/blog. So all you need to do to have a short url is replace the slug with the id.
If you use an id instead of a slug it's not needed to redirect the to show the content, the redirection is only for searchengines. And you can do that inside the method instead of using routing or an extended exception library.

I think our views are not that far apart, we just use other solutions.

I wonder what the performance of your library is when you have a site that has a busy blog and a lot of shop articles that all need a short url, the config file can grow big. And how does it handle requests when the config file is being written, doesn't that cause problems?




Theme © iAndrew 2016 - Forum software by © MyBB