开发者

How do I set up a custom URL shortener for my posts?

I have several different sites running off WordPress, and the URLs tend to get fairly long and cumbersome (particularly when I try to publish them via Twitter). I recently purchased a very short domain name, and I'd like to use it as the root of a personal URL shortening service.

So ...

  • http://www.eamann.com/portfolio would become http://eam.me/portfolio
  • http://www.mindsharestrategy.com/wp-xmlrpc-movabletype/ would become http://eam.me/df3DF
  • http://www.prosepainting.com/coffee-shop-part-1/ would become http://eam.me/csp1
  • And custom things like https://wordpress.stackexchange.com/questions/3076/feature-survey-what-would-you-want-in-a-resume-theme would become http://eam.me/wpa3076

Basically, I want to set up and manage my own TinyURL-like server ... but with some specific requirements:

  1. It should integrate fully with WordPress so I can dynamically create new short URLs whenever I create a page or a post (every piece of content I create on each site should have its own short URL).
  2. I can specify if I want the URL to be random (like /df3Df) or I can choose a unique string instead (like /wpa3076) at the time of URL creation
  3. I should be able to view/edit/manage the URLs I have in the database from within WordPress

At the moment, I'm leaning towards a standalone system lik开发者_运维百科e YOURLS that lives in its own database. The problem I'm facing (and I'll confess now that I haven't attempted it yet) is integrating the system fully with WordPress. I want each post to automatically suggest a short URL before I hit "publish" and then automatically create the URL when I finally do "publish" the post. I'd also like to administer all of my links from within each of the sites using the service.

Is this even possible? Is there already a solution around to do this? If not, where do I start?

(Cross-posted to WordPress Answers)


One of the authors of YOURLS is very active in the WordPress community, and so YOURLS does indeed have an "official" plugin to integrate it with WordPress. The plugin is described on the YOURLS site and on Ozh's website, and can also be found in the WordPress plugin directory as awats mentioned.

Unfortunately, although YOURLS supports custom short URL keywords, the plugin doesn't seem to support specifying these custom keywords from the WordPress admin.
However the YOURLS API does make an interface for this available and so it would seem to be relatively trivial to extend the plugin to support this feature.

I recommend contacting Ozh, author of the plugin and coauthor or YOURLS itself, and asking if he will consider adding the feature to the plugin.
If not you could fork the plugin and add the feature yourself (or pay someone else to do do), though then of course you also have to take on the responsibility of maintaining your fork.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜